ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Meindert" <meind...@pastelebusiness.com>
Subject RE: iBATIS, Spring, and transactions...
Date Wed, 11 Apr 2007 09:02:30 GMT
Hi Tom,

 

Thanks for your reply, but I don't understand how this will get the spring
managed service class into my struts created presentation bean.

I think that Cristian's answer might be easier?

 

Kind Regards

 Meindert

 

 

  _____  

From: Tom Duffey [mailto:tduffey@utilivisor.com] 
Sent: 10 April 2007 07:28 PM
To: user-java@ibatis.apache.org
Subject: Re: iBATIS, Spring, and transactions...

 

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-a
tconfigurable

 

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

 

Tom


Mime
View raw message