Affects: 5.2.8

Using Spring Framework with Jersey 2.31, I've enabled the Spring Security global method security interceptors, initially with proxyTargetClass = true, which works fine.

At some point, I noticed that the JAX-RS endpoints that I want intercepted actually have interfaces, so I've set proxyTargetClass = true, which made Jersey want to instantiate the endpoint itself, since its SpringComponentProvider could no longer find it because BeanFactoryUtils.beanNamesForTypeIncludingAncestors doesn't match the existing instance with the class, because ResolvableType ends up comparing the requested type with something like com.sun.proxy.$Proxy150

As far as I see, this is triggered by the fact that Jersey requests a bean using the implementation and not the interface (well, that's because this is how I registered the component, because it causes other complications with Bean Validation), so I'm not sure if Spring can do anything about it, but it was strange/interesting to discover different behaviors 🙂

Comment From: snicoll

Given Jersey is involved, it's hard for me to determine if there's something we can improve in the core container. If you want to pursue, please share a small sample that we can run ourselves. You can attach a zip to this issue or push the code to a GitHub repository.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.