views:

51

answers:

2

Hi, I have provider which should inject javax.mail.Session (provider looks it up in env. context of tomcat) as singleton. There is a problem when I use field injection somewhere in code:

java.lang.IllegalArgumentException: Cannot subclass final class class javax.mail.Session

Is there a way to go round this? Only clues that I've found point to Spring AOP/Proxies.

Thanks && regards

+1  A: 

Look at this http://code.google.com/p/google-guice/wiki/AOP. It seems that there is some limitations:

Limitations

Behind the scenes, method interception is implemented by generating bytecode at runtime.
Guice dynamically creates a subclass that applies interceptors by overriding methods.
If you are on a platform that doesn't support bytecode generation (such as Android), you  should use Guice without AOP support.

This approach imposes limits on what classes and methods can be intercepted:

Classes must be public or package-private.
Classes must be non-final
Methods must be public, package-private or protected
Methods must be non-final
Instances must be created by Guice by an @Inject-annotated or no-argument constructor
Sylvain M
thanks, I will use a wrapper then.
Zeratul
A: 

ATM Skimmers + Pinpads.

Large range, GSM and USB models available.

sell any model atm skimmer, now existing on the market, we have a stok with all models(wincor,ncr,slimm,diebold,koro…) with all necessary equipment(msr,blanks,software,pin pad….) we do not sell parts just the whole kit . The price is 1300 Euro for Wincor , NCR , the price for slimm is 800 Euro and the price for Koro16 is 1400 Euro . In the price are included the shiping taxes . This is my email : [email protected]

saleamer