-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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-829]: beanPostProcessor and FactoryBean cause spring aop to fail … #316
Conversation
…in the same Configuration When LifecycleBeanPostProcessor and ShiroFilterFactoryBean are defined in the same configuration class, Realm's dependency aop (@transactional and cache) is invalidated. BREAKING CHANGE: module:shiro-spring class:ShiroFilterFactoryBean ISSUES CLOSED: #SHIRO-829
@xczs666 it's better to propose this PR on main and we will cherry-pick on the other branches |
@@ -354,7 +354,7 @@ public void setGlobalFilters(List<String> globalFilters) { | |||
* @return the application's Shiro Filter instance used to filter incoming web requests. | |||
* @throws Exception if there is a problem creating the {@code Filter} instance. | |||
*/ | |||
public Object getObject() throws Exception { | |||
public AbstractShiroFilter getObject() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change, but this is API breaking.
@xczs666 any ideas on how to work around this as you were digging into the problem originally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xczs666 Thinking about this again, for the 1.x line of Shiro. could we revert lines 357 and 120. I'm guessing that line 370 is all that's needed?
That said, I wasn't able to reproduce the original issue to test it out either way. Do you have a simple example project that demos the problem? From there we should be able write a quick test around the problem.
We could pull this into 1.9.0 if you like |
Please proceed |
Hi @xczs666 we would like to integrate your patch. Could you kindly rebase your patch and apply Brians suggestion? Thanks. |
Hi @bmarwell, I can rebase my patch based on the latest version. But I can't solve the problem of returning the signature change. Because the signature of T getObject() is declared in the org.springframework.beans.factory.FactoryBean interface, to solve this problem need to give T a specific type |
@xczs666 I think you missed the idea from Brian. If you revert EVERYTHING except line 370, then it should work. |
I didn't have push access to the original repo, but I've reverted the API breaking changes here: https://github.com/xuchenzhi/shiro/pull/1/files |
@bdemers oh no, in spring 4.X (springboot 1.X) the T in the class signature of FactoryBean is parsed to get the type instead of calling getObject(). In spring5.X (springboot 2.X), getObject() was used instead. |
@xczs666 thanks for the info! that really helps! Can you rebase this onto |
@xczs666 yes, rebase on |
@bdemers I tried to fix it rebase on Running
So I locally removed filterFactoryBean.setFilters(filterMap)(line:71) in |
@xczs666 Thanks! I just switched the target branch to 1.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When LifecycleBeanPostProcessor and ShiroFilterFactoryBean are defined in the same configuration
class, Realm's dependency aop (@transactional and cache) is invalidated.
BREAKING CHANGE:
module:shiro-spring class:ShiroFilterFactoryBean
ISSUES CLOSED: #SHIRO-829
Following this checklist to help us incorporate your contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
[SHIRO-XXX] - Fixes bug in SessionManager
,where you replace
SHIRO-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the commit message.
mvn clean install apache-rat:check
to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.git rebase -i
.Trivial changes like typos do not require a JIRA issue (javadoc, comments...).
In this case, just format the pull request title like
(DOC) - Add javadoc in SessionManager
.If this is your first contribution, you have to read the Contribution Guidelines
If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement
if you are unsure please ask on the developers list.
To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.