Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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]
- @Component
- @EnableConfigurationProperties(ServiceProperties.class)
- public class MyService implements IService {
- private final ServiceProperties serviceProperties;
- private final IProvider provider;
- private final org.pmesmeur.springboot.training.service.feature1.IMyFeature f1;
- private final org.pmesmeur.springboot.training.service.feature2.IMyFeature f2;
- @Autowired
- public MyService(ServiceProperties serviceProperties,
- IProvider provider,
- org.pmesmeur.springboot.training.service.feature1.IMyFeature f1,
- org.pmesmeur.springboot.training.service.feature2.IMyFeature f2) {
- this.serviceProperties = serviceProperties;
- this.provider = provider;
- this.f1 = f1;
- this.f2 = f2;
- }
- ...
- package org.pmesmeur.springboot.training.service.feature1;
- public interface IMyFeature {
- void print();
- }
- package org.pmesmeur.springboot.training.service.feature1;
- import org.springframework.stereotype.Component;
- @Component
- public class MyFeature implements IMyFeature {
- @Override
- public void print() {
- System.out.print("HelloWorld");
- }
- }
- package org.pmesmeur.springboot.training.service.feature2;
- public interface IMyFeature {
- void print();
- }
- package org.pmesmeur.springboot.training.service.feature2;
- import org.springframework.stereotype.Component;
- @Component
- public class MyFeature implements IMyFeature {
- @Override
- public void print() {
- System.out.print("FooBar");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement