shishir gowda
2017-05-15 11:30:07 UTC
I have ebean entity:
@Entity
public class Company extends Model {
@Id
public Long id;
static void foo {
Logger.info("in company");
}
...
}
A guice Module defining the interceptor:
public class Module extends AbstractModule {
protected void configure() {
CacheImpl cache = new CacheImpl();
requestInjection(cache);
bindInterceptor(subclassesOf(Company.class), any(), cache);
}
}
This does not intercept any calls made to Company (foo(), save(),get(),
find()..)
When I change bindInterceptor to a class extending Play Controller, it
works by intercepting the calls.
Can some one tell me if I am missing anything?
my methodInterceptor:
@Component
public class CacheImpl implements MethodInterceptor {
public Object invoke(MethodInvocation method) throws Throwable{
Logger.info("class {}",method.getClass().getName());
if (method.getMethod().getName() == "list") {
Logger.info("interceptor in list");
} else {
Logger.info("in interceptor for {}",
method.getMethod().getName());
}
return method.proceed();
}
}
@Entity
public class Company extends Model {
@Id
public Long id;
static void foo {
Logger.info("in company");
}
...
}
A guice Module defining the interceptor:
public class Module extends AbstractModule {
protected void configure() {
CacheImpl cache = new CacheImpl();
requestInjection(cache);
bindInterceptor(subclassesOf(Company.class), any(), cache);
}
}
This does not intercept any calls made to Company (foo(), save(),get(),
find()..)
When I change bindInterceptor to a class extending Play Controller, it
works by intercepting the calls.
Can some one tell me if I am missing anything?
my methodInterceptor:
@Component
public class CacheImpl implements MethodInterceptor {
public Object invoke(MethodInvocation method) throws Throwable{
Logger.info("class {}",method.getClass().getName());
if (method.getMethod().getName() == "list") {
Logger.info("interceptor in list");
} else {
Logger.info("in interceptor for {}",
method.getMethod().getName());
}
return method.proceed();
}
}
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/b1b8f28a-ce1f-46cd-94b8-b920b74fb153%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/b1b8f28a-ce1f-46cd-94b8-b920b74fb153%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.