New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new Aspect broke ErrorMvcAutoConfiguration #6431
Comments
It looks to me like your pointcut is too broad and it's causing everything to be proxied so that your aspect can be applied to it. It looks like you're trying to add some advice to all methods/classes that are annotated with If that's not the case, please clarify what you're trying to do. |
Thanks for quick response! I changed it to @pointcut("@annotation(com.wuyouz.AclRequired)") and it works. I am confused. In spring aop doc, it says
I only put @AclRequired annotation in controller methods, why it will impact on other classes in spring boot? |
That's really an AspectJ question as that's what Spring's using to determine whether or not the pointcut matches. The key difference is that // A match test returned maybe - if there are any subtype sensitive variables
// involved in the test (this, target, at_this, at_target, at_annotation) then
// we say this is not a match as in Spring there will never be a different
// runtime subtype.
RuntimeTestWalker walker = getRuntimeTestWalker(shadowMatch);
return (!walker.testsSubtypeSensitiveVars() || walker.testTargetInstanceOfResidue(targetClass)); You are using |
@wilkinsona Thanks a lot! I am using |
I am using spring boot 1.3.6, I tried to implement a Access control Aspect to apply to the controller, but after the Aspect added, it broke the startup of the embedded tomcat. The error is following.
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration.properties; nested exception is java.lang.IllegalArgumentException: Can not set org.springframework.boot.autoconfigure.web.ServerProperties field org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration.properties to com.sun.proxy.$Proxy53
See full log here.
I created a simple project to reproduce it. could someone please check it out ?
The text was updated successfully, but these errors were encountered: