這是我在這裏的第一篇文章,有一個愉快的一天大家:)有沒有可能通過使用Guice來攔截這樣的方法?
我創建了一個名爲「驗證」的註釋
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Validate {
Class<? extends MethodInterceptor>[] value();
}
需要被截獲的方法之前,然後裝飾它。
@Validate({OneInterceptor.class, TwoInterceptor.class})
public void doPost(HttpServletRequest req, HttpServletResponse resp) {
//Do something
}
OneInterceptor implements MethodInterceptor {.....} TwoInterceptor implements MethodInterceptor{....}
是否有可能通過使用Guice綁定這樣的攔截器?我只想讓Guice動態地在運行時綁定這些攔截器。 謝謝大家!
你讀過這一點:http://code.google.com/p/google- guice/wiki/AOP – RJo