I've run across something confusing to me in getting Dependency Injection with
Spring to work with Type Converters under Struts 2.

I tried creating a StrutsTypeConverter subclass that had a @Transactional
annotation with a @PersistenceContext on an EntityManager property (via the
setter). The Converter was declared as a bean in the applicationContext.
However the EM was not injected.

I then made a wrapper class (Workspace) around an EntityManager (only exposes a
get/set EntityManager), this wrapper class also had the @Transaction and
@PersistenceContext annotations. The Workspace was declared in the application
context.

I then made the converter expose a setWorkspace method. The converter was no
longer listed in the ApplicationContext. However now the EM gets successfully
injected into the Workspace; and the Workspace gets injected into the
converter.

What is the difference, in these two approaches that causes one to work and one
to not?

Is there something unique about the StrutsTypeConverter class that causes
auto-wire by name to work successfully (without even a bean definition of the
converter), but not @Transactional/@PersistenceContext annotations?

Thank you.

Eric

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

Reply via email to