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-890] Avoid another proxy creator when @EnableAspectJAutoProxy enabled #472

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

georgecao
Copy link
Contributor

@georgecao georgecao commented Oct 7, 2022

See #268 for the previous fix. But when @EnableAspectJAutoProxy enabled, spring actually creates an instance of AnnotationAwareAspectJAutoProxyCreator but not DefaultAdvisorAutoProxyCreator. In this situation, there will be two proxy creators in the same context, which leads to methods be proxied twice also .

The fix may just remove the type value of the @ConditionalOnMissingBean.

    @Bean
    @DependsOn("lifecycleBeanPostProcessor")
    @ConditionalOnMissingBean(name = AopConfigUtils.AUTO_PROXY_CREATOR_BEAN_NAME)
    @Override
    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
        return super.defaultAdvisorAutoProxyCreator();
    }
@fpapon fpapon self-requested a review October 7, 2022 05:46
@fpapon
Copy link
Member

fpapon commented Oct 7, 2022

@georgecao thanks for the PR! Is there a way to add a unit test to validate the fix?

@georgecao
Copy link
Contributor Author

georgecao commented Oct 7, 2022

@fpapon Sure. Will come back when unit test is ready.

@georgecao
Copy link
Contributor Author

@bdemers I formats the pom.xml by IntellIJ's project code style. Is there a code style guide that I missed?

@fpapon
Copy link
Member

fpapon commented Oct 7, 2022

@georgecao thanks for the unit tests!
Can you squash the commit please?

@bdemers
Copy link
Member

bdemers commented Oct 7, 2022

@georgecao nope, I was just removing the white space to help reduce the diff to the lines needed. It helps when backporting too.

Thanks for the patch!!

@georgecao
Copy link
Contributor Author

@georgecao thanks for the unit tests!

Can you squash the commit please?

Done.

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.

@georgecao Thank you very much for your contribution!

@georgecao
Copy link
Contributor Author

Looks like CI builds are not stable, logInAndRememberMe fails occasionally. @fpapon @bdemers

@fpapon
Copy link
Member

fpapon commented Oct 10, 2022

Looks like CI builds are not stable, logInAndRememberMe fails occasionally. @fpapon @bdemers

Yes it's a know issue, don't worry it's not related to your PR.

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