JAVA 1.8 Autowire:没有独特的豆子

时间:2015-03-24 13:15:14

标签: java spring aop

我在Java 1.6中有一个项目,我必须传入java 1.8。

我收到此错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.amm.noc.telecom.reporting.services.TicketManager net.amm.noc.telecom.reporting.integration.itest.EndToEndTestCase.ticketManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [net.amm.noc.telecom.reporting.services.TicketManager] is defined: expected single matching bean but found 2: [ticketManager, proxiedTicketManagerImpl]

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [net.amm.noc.telecom.reporting.services.TicketManager] is defined: expected single matching bean but found 2: [ticketManager, proxiedTicketManagerImpl]

Exception in thread "ActiveMQ ShutdownHook" java.lang.NoClassDefFoundError: org/apache/activemq/transport/vm/VMTransportFactory
    at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:518)
    at org.apache.activemq.broker.BrokerService.containerShutdown(BrokerService.java:1754)
    at org.apache.activemq.broker.BrokerService$4.run(BrokerService.java:1732)
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.transport.vm.VMTransportFactory
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    ... 3 more

我的班级考试:

@ContextConfiguration(locations = { "classpath:/application-context.xml" })
public class EndToEndTestCase extends AbstractTestNGSpringContextTests {

    @Autowired
    @Qualifier("ticketManager")
    private TicketManager ticketManager;

    /**
     * This test relies on the proxied ticketManager (stub) to send the NLV
     * buffer on the bus. The deployed skeleton intercepts the message,
     * transform it and delegates the process to the actual bean.
     */
    @Test
    public void test1() {...

appContext:

    <!-- defines which bean are service requests delegated to  -->
    <alias name="proxiedTicketManagerImpl" alias="ticketManagerImpl" />

    <!-- defines which bean are response requests delegated to  -->
    <alias name="proxiedTicketResponseImpl" alias="ticketResponseImpl" />
    <bean id="telecomReportingMethodInvocationInterceptor"
        class="net.amm.noc.integration.itest.MethodInvocationInterceptor">
        <property name="channel" value="TICKET-MANAGER" />
    </bean>
    <bean id="proxiedTicketManagerImpl" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyTargetClass" value="true" />
        <property name="target">
            <bean
                class="net.amm.noc.telecom.reporting.mock.TicketManagerMock">
                <property name="ticketResponse" ref="ticketResponse" />
            </bean>
        </property>
        <property name="interceptorNames">
            <list>
                <value>telecomReportingMethodInvocationInterceptor</value>
            </list>
        </property>
    </bean>
    <bean id="proxiedTicketResponseImpl" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyTargetClass" value="true" />
        <property name="target">
            <bean class="net.amm.noc.telecom.reporting.mock.TicketResponseMock" />
        </property>
        <property name="interceptorNames">
            <list>
                <value>telecomReportingMethodInvocationInterceptor</value>
            </list>
        </property>
    </bean>
<bean id="ticketManager" class="org.springframework.aop.framework.ProxyFactoryBean">
    <property name="interfaces" value="net.amm.noc.telecom.reporting.services.TicketManager" />
    <property name="proxyInterfaces" value="net.amm.noc.telecom.reporting.services.TicketManager" />
    <property name="target">
        <bean class="java.lang.Object" />
    </property>
    <property name="interceptorNames">
        <list>
            <value>telecomReportingServiceInterceptor</value>
        </list>
    </property>
</bean>
<bean id="telecomReportingServiceInterceptor"
    class="net.amm.noc.integration.client.aop.ServiceInterceptor">
    <property name="serviceMessageEncoder" ref="telecomReportingEncoder" />
    <property name="serviceCaller">
        <bean class="net.amm.noc.integration.mep.client.MepServiceCaller">
            <property name="responseListener" ref="telecomReportingResponseListener"></property>
            <property name="contextFactory">
                <bean
                    class="net.amm.noc.integration.mep.client.MepServiceClientContextFactory"
                    init-method="init">
                    <property name="serviceDefinition">
                        <bean
                            class="net.amm.noc.integration.mep.service.GenericServiceDefinition">
                            <property name="category" value="NOC" />
                            <property name="name" value="TEL_REPORT" />
                        </bean>
                    </property>
                </bean>
            </property>
        </bean>
    </property>
</bean>

有谁可以帮我解决这个问题? 有关信息,Java 1.6可以正常使用 谢谢。

0 个答案:

没有答案