Skip to content
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

[SHIRO-804] - Avoid conflicts with spring boot aop #344

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

markixy
Copy link

@markixy markixy commented Jan 26, 2022

#268

I found the problem related to the resolution order of Configuration. The ProxyCreator automatically created by Spring AOP is implemented through AopAutoConfiguration.
There are two cases:

  1. First parse AopAutoConfiguration, will create a ProxyCreator, then parse ShiroAnnotationProcessorAutoConfiguration, judge @ConditionalOnMissBean, ProxyCreator already exists, no more ProxyCreator will be created. (good case)
  2. First parse ShiroAnnotationProcessorAutoConfiguration, judge @ConditionalOnMissBean, there is no ProxyCreator, will create a ProxyCreator, then parse AopAutoConfiguration, will create the ProxyCreator again. (two ProxyCreators exist in the IOC, incorrect case!)

My version is:
shiro-spring-boot-starter:1.8.0
spring-boot-starter-aop:2.3.1.RELEASE

So, to be on the safe side, add @AutoConfigureAfter(AopAutoConfiguration.class) to the ShiroAnnotationProcessorAutoConfiguration.

Copy link
Member

@bdemers bdemers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @markixy !
The change looks good, just waiting on CI now!

@fpapon fpapon changed the title Avoid conflicts with spring boot aop Jan 26, 2022
@fpapon fpapon self-requested a review January 27, 2022 07:21
Copy link
Member

@fpapon fpapon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fpapon
Copy link
Member

fpapon commented Jan 27, 2022

@markixy thanks for your contribution!

@fpapon fpapon merged commit 4bbd16d into apache:main Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants