Issue
I am frequently getting the below error while running the application in eclipse. does anyone come across this problem or know how to fix it?
org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.employee.service.customfield.impl.EmployeeMapper] is defined: expected single bean but found 0:
The same application works fine in command promot via mvn (maven)
Please let me know how to resolve this.
Thanks.
Solution
What this error means is that your configuration is different between Eclipse and your command line (probably caused by a difference in the classpath). If you're running this from Eclipse using a run configuration, you probably need to make some tweaks to the classpath settings either in the run config, or on the project's build path.
As an example, if you've got a spring-mybatis.xml
application context file under src/main/resources
that defines your EmployeeMapper
bean, but Eclipse isn't configured to pick this up as part of the build path, this would cause an error like this (maven will pick up this directory by default)
Answered By - Mark
Answer Checked By - David Goodson (JavaFixing Volunteer)