Community

@Autowiring of beans from Spring applicationcontext

reply from Susana Quintana in Spring Integration - View the full discussion

Hi,

 

Im using your example to do something similar, but in any case my bean is not wired. Can someone help me to figure out the problem, or could you post your working example.

 

Thanks:

 

Im using JBOSS 5.1.0 GA and \jboss-spring-3.2.CR1.deployer

-------------------------

Ear structure:

------------------------

<application xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="5"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
  <display-name>app-server</display-name>
    <module>
    <java>persistence.jar</java>
  </module>
    <module>
    <java>controller.jar</java>
  </module>
</application>

 

-------------------------

dao-context.xml (is in persistence.jar /meta-inf

------------------------

    <bean id="trackingRecordDAO">
        <constructor-arg index="0">
            <ref bean="dataSource"/>
        </constructor-arg>
        <constructor-arg index="1" value="-5"/>
    </bean>

 

    <bean id="datasource">
        <property name="jndiName">
            <value>demotracking.databasePool</value>
        </property>
    </bean>
</beans>

 

-------------------------

jboss-spring.xml (is in controller.jar /meta-inf

------------------------

<description>BeanFactory=(SpringDao)</description>
     <import resource="classpath*:dao-context.xml"/>

 

     <bean id="jobDetail">
        <property name="targetObject" ref="gao_receiver02" />
        <property name="targetMethod" value="readTags" />
        <property name="concurrent" value="false" />
    </bean>

 

    <bean id="gao_receiver02">
        <constructor-arg value="100.105.130.224"/>
    </bean>

 

    <bean id="simpleTrigger">
        <property name="jobDetail" ref="jobDetail" />
        <property name="startDelay" value="0" />
        <property name="repeatInterval" value="60" />
    </bean>

 

    <bean>
        <property name="triggers">
            <list>
                <ref bean="simpleTrigger" />
            </list>
        </property>
    </bean>
</beans>

 

--------

 

------

 

I did try the following code line to instatiate the bean in a class which is in the controller.jar but the bean is not wired :(

 

@Autowired
    public TrackingRecordDAOImpl dao; 

Reply to this message by going to Community

Start a new discussion in Spring Integration at Community