0

I have two beans with the same name in different packages:

package A;

class EMDao {}

package B;

class EMDao {}

package C;

import B.EMDao;
class EMService { @Resource EMDao emDao; }

I get this exception:

org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name for bean class EMDao conflicts with existing, non-compatible bean definition of same name and class B.EMDao.

Now I am trying to do this:

package B;

@Qualifier(value="bEMDao")
class EMDao {}

package C;

import B.EMDao;
class EMService { @Qualifier(value="bEMDao") @Resource EMDao emDao; }

But I am still getting the same error.

Any help would be greatly appreciated.

Thanks

Glenn
  • 8,932
  • 2
  • 41
  • 54
user1539343
  • 1,569
  • 6
  • 28
  • 45

1 Answers1

0

Of course you will get the same error because you specify the same values for bean names: value="bEMDao". The bean names should differ, e.g. value="bEMDao"

havryliuk
  • 136
  • 1
  • 11