Actually, if the class using userDAO doesn't extend Component, you have to add InjectorHolder.getInjector().inject(this) in the constructor of the calling class.

David Nedrow wrote:
I believe (though I'm clearly wrong in that belief) that I have everything properly configured to allow spring injection along the lines of:

import com.foo.dao.UserDAO;
@Spring
private UserDAO userDAO;

Meaning that for a bean defined in the applicationContext as . . .

    <bean id="UserDAO" class="com.foo.dao.UserDAO">
<property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

. . . I don't have to do anything else to utilize the bean. There is an added complexity in that I am using interfaces for the DAOs, ie. UserDAO implements IUserDAO.

I've tried using different combinations of interface and dao, like the following

import com.foo.dao.IUserDAO;
import com.foo.dao.UserDAO;
@Spring(name=userDAO)
private IUserDAO userDAO;

No matter what I've tried, userDAO remains unitialized.

I have to resort to the following to get hold of the DAO...

ApplicationContext applicationContext = ((WicketApplication) Application.get()).getContext(); IUserDAO dao = UserDAO.getFromApplicationContext(applicationContext);



Anyone have a guess at what I'm not doing correctly?

I should note that in the main application class, the init makes the following call . . .

addComponentInstantiationListener(new SpringComponentInjector(this));


And the entity manager is defined as follows . . .

    <bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitManager" ref="persistenceUnitManager"/>
        <property name="persistenceUnitName" value="NetConfPU"/>
    </bean>


-David

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to