1. 程式人生 > >Exception in thread "main" org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qua

Exception in thread "main" org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qua

Exception in thread "main" org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.myflow.Component.workflow.WorkflowServiceInter' available: expected single matching bean but found 2: workflowService,workflowServiceInter
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1041)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:345)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:340)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1090)

at com.myflow.util.Test.main(Test.java:17)


解決辦法

spring-mybatis.xml中。出現重複的掃描包,將其中一個去掉,或者將路徑寫的更具體一點。避免衝突