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

WW-5381 Introduce extension point for CompoundRootAccessor #824

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

kusalk
Copy link
Member

@kusalk kusalk commented Dec 29, 2023

WW-5381

Fairly straightforward

@kusalk kusalk force-pushed the WW-5381-compoundroot-interface-2 branch from 61d2619 to 11f4fa3 Compare December 29, 2023 02:53
@kusalk kusalk force-pushed the WW-5381-compoundroot-interface-2 branch from 11f4fa3 to aef5d5c Compare December 29, 2023 02:58
@Inject
protected void setCompoundRootAccessor(RootAccessor compoundRootAccessor) {
this.compoundRootAccessor = compoundRootAccessor;
OgnlRuntime.setPropertyAccessor(CompoundRoot.class, compoundRootAccessor);
Copy link
Member Author

Choose a reason for hiding this comment

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

Unified the previously 3 separate instances of CompoundRootAccessor

@kusalk
Copy link
Member Author

kusalk commented Dec 29, 2023

(SonarCloud report is comparing against wrong base branch)

Base automatically changed from WW-5381-compoundroot-interface to master January 3, 2024 00:41
@kusalk kusalk marked this pull request as ready for review January 3, 2024 00:42
@kusalk kusalk requested a review from lukaszlenart January 3, 2024 00:43
Copy link
Member

@lukaszlenart lukaszlenart left a comment

Choose a reason for hiding this comment

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

Looks good, just one small comment

Comment on lines -177 to 178
<bean type="ognl.ClassResolver" name="com.opensymphony.xwork2.util.CompoundRoot"
<bean type="com.opensymphony.xwork2.ognl.accessor.RootAccessor" name="struts"
class="com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor"/>
Copy link
Member

Choose a reason for hiding this comment

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

Could this be a breaking change? Maybe somehow mention that ClassResolver shouldn't be used anymore and implement CompoundRoot instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep very true - looks like our bundled version of Guice is quite old and doesn't support binding beans to multiple interfaces. Although that might not work here either since the Bean name has also changed.

I can create a 2nd bean using the old interface and name to prevent injection failures but obviously this bean won't be the same one used by the OgnlValueStackFactory - it might be fine depending on what these classes intend to do with the CompoundRootAccessor bean, and if they really need it to share state with the bean injected into OgnlValueStackFactory

Copy link
Member Author

Choose a reason for hiding this comment

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

Done - reinstated the old beans for injection compatibility with any custom beans written for Struts 6.3 or earlier

@kusalk kusalk force-pushed the WW-5381-compoundroot-interface-2 branch from 4ae768e to f3c160d Compare January 3, 2024 10:44
# Conflicts:
#	core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
@kusalk kusalk merged commit 370d882 into master Jan 3, 2024
6 of 7 checks passed
@kusalk kusalk deleted the WW-5381-compoundroot-interface-2 branch January 3, 2024 12:11
Copy link

sonarqubecloud bot commented Jan 3, 2024

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

Successfully merging this pull request may close these issues.

2 participants