ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Duffey <tduf...@utilivisor.com>
Subject Re: iBATIS, Spring, and transactions...
Date Tue, 10 Apr 2007 17:28:23 GMT
Hi,

On Apr 10, 2007, at 11:30 AM, Meindert wrote:

> My question is;
>
> a) can I still use org.apache.struts.beanaction.BeanAction? I only  
> want to change the DAO to Spring DAO because IBATIS DAO is depreciated
>
> and if so
>
> b) The BeanAction class is using
>
> private static final TheService theService = TheService.getInstance();
>
> to connect with the service object, what created itself static;
>
> private static final TheService instance = new TheService();
>
> How do I get a instance from the spring created service object?
Yes, you can do this.  Since your BeanAction is not a Spring managed  
bean you can use @Configurable to dependency inject arbitrary objects  
in your application:

http://static.springframework.org/spring/docs/2.0.x/reference/ 
aop.html#aop-atconfigurable

This only works if you are using JDK5 and are willing to add AspectJ  
to your project :)

Tom
Mime
View raw message