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 #268

Merged
merged 1 commit into from
May 19, 2021

Conversation

seaswalker
Copy link
Contributor

@seaswalker seaswalker commented Dec 16, 2020

If there is a spring-boot-starter-aop dependency in the project's classpath, Spring will automatically create a bean named "org.springframework.aop.config.internalAutoProxyCreator".
This will cause Spring beans to be proxied twice. If one is a JDK dynamic proxy and the other is a CGLIB proxy, then the system will fail to start.
We may be able to avoid such errors by modifying the defaultAdvisorAutoProxyCreator method of the ShiroAnnotationProcessorAutoConfiguration class.
I have tested this modification in my own project and it works. Sorry, my English is not very good, this paragraph is written using Google Translate.

Spring boot log:

ShiroAnnotationProcessorAutoConfiguration#defaultAdvisorAutoProxyCreator:
    Did not match:
        - @ConditionalOnMissingBean (names: org.springframework.aop.config.internalAutoProxyCreator; types: org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; SearchStrategy: all) found beans named org.springframework.aop.config.internalAutoProxyCreator (OnBeanCondition)
@fpapon fpapon requested a review from bdemers May 8, 2021 05:43
@fpapon
Copy link
Member

fpapon commented May 8, 2021

@bdemers I'm not a Spring expert so can you review and merge please?

@bdemers
Copy link
Member

bdemers commented May 18, 2021

Looks good, we need to figure out what is going on we CI (looks unrelated to this PR)

@fpapon
Copy link
Member

fpapon commented May 18, 2021

Looks good, we need to figure out what is going on we CI (looks unrelated to this PR)

Weird because all is green on Jenkins but not in the GH report

@bmarwell
Copy link
Contributor

@fpapon no, it failed, because GH is using the old jenkins test (5 months ago) from here:
https://ci-builds.apache.org/blue/organizations/jenkins/Shiro%2FShiro-jdk11/detail/PR-268/1/pipeline

[ERROR]   AuthorizationFilterTest.testUserOnAccessDeniedWithResponseError:45 

  Unexpected method call Subject.login(org.apache.shiro.authc.UsernamePasswordToken - test, rememberMe=false):

``


That has bee f xed, but the  tests have not been  re-run on GH.
@bmarwell
Copy link
Contributor

I'd say merge, the new PRs will not have the outdated checks.

@fpapon
Copy link
Member

fpapon commented May 19, 2021

@bdemers rebased and pushed as branch:

* https://github.com/apache/shiro/actions/runs/856443635

* https://ci-builds.apache.org/blue/organizations/jenkins/Shiro%2FShiro-all/detail/SHIRO-804_avoid_conflict_with_spring/1/pipeline

Once green, we can merge this.

all is green so I can merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants