【发布时间】:2016-11-17 20:47:36
【问题描述】:
我想用 Google guice 拦截一个构造函数。
我已经在 TYPE 上添加了我的注释标记,但是“bindInterceptor”有一些问题
如果我写
bindInterceptor(Matchers.annotatedWith(ReactToLoad.class),
Matchers.any(),
new ReactToLoadInterceptor());
这将在每个方法上运行拦截器。 (很糟糕,很正常)
bindInterceptor( Matchers.any(),
Matchers.annotatedWith(ReactToLoad.class),
new ReactToLoadInterceptor());
如果我运行下面的代码,我必须将注释放在构造函数方法上(它有效),但我更喜欢将此注释放在类之上。
我只需要一个用于构造函数的方法 Matchers,但我没有通过谷歌搜索找到它。
你能帮帮我吗?
【问题讨论】:
标签: guice