I want to create an TracingInterceptor. It works fine on normal
methods, but doesn't work with static methods.
I think the Dependency Injection is implemented by using the Proxy-
Pattern. This could be the reason for my Problem, because you can't
build a proxy over a class using static methods. But how can i
intercept static methods?
Is this possible with Guice?
Greetings
Fabian Wohlschläger
This could be the reason for my Problem, because you can't
build a proxy over a class using static methods. But how can i
intercept static methods?
Is this possible with Guice?
Greetings
Fabian Wohlschläger
--
Gregory Kick
http://kickstyle.net/
hey, just saw the original post, and I made an interceptor for what
you're talking about (i think) that you might want to take a look at.
On 5/14/07, Dhanji R. Prasanna <dha...@gmail.com> wrote:
>
>
I checked your solutions and it seems there is really no choice than
manipulate bytecode or using AspectJ with compile time weaving (as you
said).
In my opinion this is much work to do, just for using aspect-oriented
features. The only economic/fast solution seems to place aspects (like
tracing/logging) directly in static methods. This would be kind of
mix, because the aspects are in static classes and in the
interceptors, but using code weaving + aspectJ or Bytecode
manipulation is rather complex.
First of all thank you very much for your answers!
I checked your solutions and it seems there is really no choice than
manipulate bytecode or using AspectJ with compile time weaving (as you
said).
package de.fabe.guice.impl.dao;
public class ServiceDaoImpl {
private static ServiceDaoImpl mInstance;
private ServiceDaoImpl() {
}
public static ServiceDaoImpl getInstance() {
System.out.println("getInstance of ServiceDao");
if (mInstance == null) {
mInstance = new ServiceDaoImpl();
}
return mInstance;
}
}
How should I get rid of the static method?
package de.fabe.guice.impl.dao;
public class ServiceDaoImpl {
private static ServiceDaoImpl mInstance;
private ServiceDaoImpl() {
}
public static ServiceDaoImpl getInstance() {
System.out.println("getInstance of ServiceDao");
if (mInstance == null) {
mInstance = new ServiceDaoImpl();
}
return mInstance;
}
}
How should I get rid of the static method?
On 14 Mai, 19:24, "Bob Lee" <crazy...@crazybob.org> wrote:
Thanks for your post.
One of my targets is an evaluation of Guice in comparison to Spring.
If I use Spring AOP i clould use Spring DI either ;)
--
Cheers, Stuart
@Dhanji R. Prasanna
Seems that Spring AOP is based on Proxies, too. The only way to fix
this problem is AspectJ.
http://forum.springframework.org/archive/index.php/t-26790.html
@Stuart McCulloch
Brilliant idea!
I'm such a fool ;)
@Dhanji R. Prasanna
Seems that Spring AOP is based on Proxies, too. The only way to fix
this problem is AspectJ.
http://forum.springframework.org/archive/index.php/t-26790.html
On 16 Mai, 20:10, "Dhanji R. Prasanna" <dha...@gmail.com> wrote: