2016-03-30 7 views
1

günlük görünür aşağıdaki I, basit bir tek fasulye enjeksiyonu almak MDB, ama ben bu MDB mesaj göndermek her zaman EJB ve Bahar 4 kullanarak bir JavaEE 6 uygulama var:SpringBeanAutowiringInterceptor

com.oracle.pitchfork.interfaces.LifecycleCallbackException: Failure to invoke public void org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(javax.interceptor.InvocationContext) on bean class class app.module.mdb.impl.SpringBeanAutowiringInterceptor2_curj4r_Impl with args: [LifecycleEventCallbackInvocationContext(1495657191)] 

.. 

Caused By: org.springframework.beans.factory.BeanCreationException: Injection of autowired dependencies failed for class [class app.module.mdb.impl.TestMDB]; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private app.module.bizo.impl.TestBOImpl app.module.mdb.impl.TestMDB.bizo; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [app.module.bizo.impl.TestBOImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 

Neyi yanlış yaptığımı bilmek istiyorum, çünkü her şeyi düzgün bir şekilde yapılandırdım.

MDB:

@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), 
     @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"), 
     @ActivationConfigProperty(propertyName = "connectionFactoryJndiName") }) 
@TransactionManagement(TransactionManagementType.CONTAINER) 
@Interceptors(SpringBeanAutowiringInterceptor2.class) 
public class TestMDB implements MessageListener { 

    @Autowired 
    private TestBO bizo; 

    @Logging 
    @Override 
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) 
    public void onMessage(final Message message) { 
     try { 

      this.bizo.process(message); 
     } catch (final Exception e) { 
      throw new RuntimeException(e.getCause()); 
     } 

    } 

} 

BO:

@Component 
public class TestBOImpl implements TestBO, Serializable { 

    /** 
    * 
    */ 
    private static final long serialVersionUID = 1L; 

    @Override 
    public void process(Message message) throws BusinessException { 
     System.out.println("Im here!"); 

    } 

} 

Yapılandırma:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" 
    xmlns:task="http://www.springframework.org/schema/task" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx-4.0.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd 
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd 
    http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd"> 


    <context:annotation-config /> 
    <context:component-scan base-package="app.module" /> 

</beans> 

XML Ref:

<?xml version="1.0" encoding="UTF-8"?> 
<beans 
    xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> 

    <bean id="IDContext" class="org.springframework.context.support.ClassPathXmlApplicationContext"> 
     <constructor-arg value="/META-INF/app-config.xml" /> 
    </bean> 
</beans> 

Teşekkürler.

cevap