To whom it may concern,
On 7/18/23 22:50, X wrote:
My team is developing a new web app with tomcat 9.0.65 and Spring
boot 2.7.4. We declare a @ServerEndpoint annotated class, which
can not be aop-proxied.
The root cause is the tomcat implemented like this:
ServerEnpoint annotation = pojo.getAnnotation(ServerEnpoint.class);
When Spring uses CGlib to create proxy class, the subclass does not
has @ServerEndpoint annotation, so the bootstrap fails.
Subclass impls are so common in CDI container, there are common
scenario to combine AOP and @ServerEnpoint together. There was
similar issue raised for glassfish/undertow already(for example:
https://github.com/jakartaee/websocket/issues/229). We also agree
that ServerEndpoint is declared as not @inherited according to javax
spec. But since many developer need to proxy ServerEnpoint instance,
can tomcat do some workaround, just do some recursive super class
scan to get annotation instead of fast-fail?
Hope kind answer to explain why tomcat is implemented like what it is
now(in 9.0.65 ), thanks in advance.
If you read https://github.com/jakartaee/websocket/issues/229 you'll see
why the Jakarta EE declined to make the annotation inheritable.
I'm not sure how your AOP framework works, but you'll have to instruct
that framework to ensure that the proxy class ends up inheriting the
annotations.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org