Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'myFeature' for bean class [org.pmesmeur.springboot.training.service.feature2.MyFeature] conflicts with existing, non-compatible bean definition of same name and class [org.pmesmeur.springboot.training.service.feature1.MyFeature]
  2.  
  3. @Component
  4. @EnableConfigurationProperties(ServiceProperties.class)
  5. public class MyService implements IService {
  6.  
  7. private final ServiceProperties serviceProperties;
  8. private final IProvider provider;
  9. private final org.pmesmeur.springboot.training.service.feature1.IMyFeature f1;
  10. private final org.pmesmeur.springboot.training.service.feature2.IMyFeature f2;
  11.  
  12.  
  13. @Autowired
  14. public MyService(ServiceProperties serviceProperties,
  15. IProvider provider,
  16. org.pmesmeur.springboot.training.service.feature1.IMyFeature f1,
  17. org.pmesmeur.springboot.training.service.feature2.IMyFeature f2) {
  18. this.serviceProperties = serviceProperties;
  19. this.provider = provider;
  20. this.f1 = f1;
  21. this.f2 = f2;
  22. }
  23. ...
  24.  
  25. package org.pmesmeur.springboot.training.service.feature1;
  26.  
  27. public interface IMyFeature {
  28.  
  29. void print();
  30.  
  31. }
  32.  
  33. package org.pmesmeur.springboot.training.service.feature1;
  34.  
  35. import org.springframework.stereotype.Component;
  36.  
  37. @Component
  38. public class MyFeature implements IMyFeature {
  39.  
  40. @Override
  41. public void print() {
  42. System.out.print("HelloWorld");
  43. }
  44.  
  45. }
  46.  
  47. package org.pmesmeur.springboot.training.service.feature2;
  48.  
  49. public interface IMyFeature {
  50.  
  51. void print();
  52.  
  53. }
  54.  
  55. package org.pmesmeur.springboot.training.service.feature2;
  56.  
  57. import org.springframework.stereotype.Component;
  58.  
  59.  
  60. @Component
  61. public class MyFeature implements IMyFeature {
  62.  
  63. @Override
  64. public void print() {
  65. System.out.print("FooBar");
  66. }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement