Spring:对于预期至少1个匹配bean的类型不满意

时间:2016-07-04 09:58:46

标签: java spring jboss6.x

更改Jboss服务器后(4.2 - > 6.1 EAP) 我收到这个错误:

   11:52:07,177 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/saper]] (ServerService Thread Pool -- 55) JBWEB000287: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainProxy': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainList': Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.OrderedFilterBeanDefinitionDecorator$OrderedFilterDecorator] while setting bean property 'filters' with key [8]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4': Cannot resolve reference to bean 'customAuthenticationProcessingFilter' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customAuthenticationProcessingFilter': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.alt.prj.services.ProjectDirManager com.alt.prj.spring.CustomAuthenticationProcessingFilter.pdmanager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.alt.prj.services.ProjectDirManager] is defined: Unsatisfied dependency of type [class com.alt.prj.services.ProjectDirManager]: expected at least 1 matching bean
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) [spring-2.5.6.jar:2.5.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) [spring-2.5.6.jar:2.5.6]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_71]

任何想法(在Jboss 4.2上工作)?

的applicationContext.xml

<context:component-scan base-package="com.alt.prj"> <!--scoped-proxy="interfaces"-->
    <context:include-filter type="regex" expression="com.alt.prj.projectdir.Maintain*"/>
    <context:include-filter type="regex" expression="com.alt.prj.services.ProjectDirManager"/>
    <context:include-filter type="regex" expression="com.alt.prj.common.*"/>
</context:component-scan>
<context:annotation-config />

ProjectDirManager.java

@Service
public class ProjectDirManager extends AbstractGenericManager {

完整筹码:

 11:52:07,177 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/saper]] (ServerService Thread Pool -- 55) JBWEB000287: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainProxy': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainList': Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.OrderedFilterBeanDefinitionDecorator$OrderedFilterDecorator] while setting bean property 'filters' with key [8]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4': Cannot resolve reference to bean 'customAuthenticationProcessingFilter' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customAuthenticationProcessingFilter': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.alt.prj.services.ProjectDirManager com.alt.prj.spring.CustomAuthenticationProcessingFilter.pdmanager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.alt.prj.services.ProjectDirManager] is defined: Unsatisfied dependency of type [class com.alt.prj.services.ProjectDirManager]: expected at least 1 matching bean
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) [spring-2.5.6.jar:2.5.6]
        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_71]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) [spring-2.5.6.jar:2.5.6]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) [spring-2.5.6.jar:2.5.6]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) [spring-2.5.6.jar:2.5.6]
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) [spring-2.5.6.jar:2.5.6]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) [spring-2.5.6.jar:2.5.6]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) [spring-2.5.6.jar:2.5.6]
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
        at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
        at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
        at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_71]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainList': Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.OrderedFilterBeanDefinitionDecorator$OrderedFilterDecorator] while setting bean property 'filters' with key [8]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4': Cannot resolve reference to bean 'customAuthenticationProcessingFilter' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customAuthenticationProcessingFilter': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.alt.prj.services.ProjectDirManager com.alt.prj.spring.CustomAuthenticationProcessingFilter.pdmanager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.alt.prj.services.ProjectDirManager] is defined: Unsatisfied dependency of type [class com.alt.prj.services.ProjectDirManager]: expected at least 1 matching bean
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) [spring-2.5.6.jar:2.5.6]
        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_71]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) [spring-2.5.6.jar:2.5.6]
        at org.springframework.security.config.FilterChainProxyPostProcessor.postProcessBeforeInitialization(FilterChainProxyPostProcessor.java:52) [spring-security-core-2.0.6.RELEASE.jar:]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331) [spring-2.5.6.jar:2.5.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) [spring-2.5.6.jar:2.5.6]
        ... 25 more

0 个答案:

没有答案