Skip to content

Instantly share code, notes, and snippets.

Field myShapeOne in com.lici.spring.bean.shape.ShapeService required a single bean, but 2 were found:
....
Field myShapeTwo in com.lici.spring.bean.shape.ShapeService required a single bean, but 2 were found:
@RestController
@RequestMapping("/user")
public class UserController {
@RequestMapping(value={"/find", "/search*","/get/*","**/findall"}, method = RequestMethod.GET)
public String findAllUsers() {
return "GettingUsers";
}
}
@RestController
@RequestMapping("/user")
public class UserController {
@RequestMapping(value="/find", method = RequestMethod.GET)
public void findAllUsers() {
/**
* Adding user logic
*/
}
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Controller {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any (or empty String otherwise)
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Repository {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any (or empty String otherwise)
@Bean
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
return new PersistenceExceptionTranslationPostProcessor();
}
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Indexed
public @interface Component {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any (or empty String otherwise)
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Service {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any (or empty String otherwise)
@Component
public class MyComponent {
/**
* Can able to directly mention the value inside @Value annotation
*/
@Value("Hello Sample")
private String sampleValue;
/**
* the value for the property lici.value read from the application.properties file
lici.value=Hello Sample
lici.myproperty = Hello My Property
lici.array = First,Second,Third
lici.myrank = 4
lici.underscore.values=A_B_C
lici.kevin.details={name: 'ajin', age: '23', country: 'india'}