Unexpected interceptor behavior
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 1.7k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
We had a problem where Guice would not apply method-interceptors, neither the ones that come with shiro nor the ones we created outselfs. An nearly identical setup works in our JavaFX apps.
After a lot of tinkering this is what we found:
**Working version**:
https://gist.github.com/WowMuchName/49736aef6a0de919a3491ac6517b2da3#file-bootstrap_working-java
_Output (Part):_
[...]
@X() (xxx.BootStrap$X:ALL in 662a0cc6)
java.io.IOException
at xxx.BootStrap$X.(BootStrap.java:40)
at xxx.BootStrap$X$$**EnhancerByGuice**$$5856a3cb.()
[...]
Intercepted[Test]
_Endofoutput_
**None-working version**:
https://gist.github.com/WowMuchName/49736aef6a0de919a3491ac6517b2da3#file-bootstrap_not_working-java
The only difference is that instead of
`Guice.createInjector(allMyModules)`
we do
`Guice.createInjector(modulesPart1).createChildInjector(modulesPart2)`
Ouput:
@X() (xxx.BootStrap$X:ALL in 67ca9a88)
Test
java.io.IOException
at xxx.BootStrap$X.(BootStrap.java:40)
at xxx.BootStrap$X$$**FastClassByGuice**$$f986fcc8.newInstance()
As can be seen injection **does** work. What doesn't work is interception. Guice creates a Fast not an Enhanced class.
Are we missing something here? So far we are unable to reproduce this outside the servlet container. If this for some reason is a none-fixable issue or even desired it should be documented. Our expectation was that Guice would work in the Servlet-Container as it does in a standalone app which doesn't seem to be the case.
Contributor guide
Assessment
This issue has not been assessed yet.