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

Provide a way to override the ReflectiveMethodResolver so that subclasses can provide thier own static methods [SPR-9038] #13677

Closed
spring-projects-issues opened this issue Jan 18, 2012 · 3 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Satyapal Reddy opened SPR-9038 and commented

(I discussed this with Andy Clement on email)

We want to use a set of static methods declared on set of classes to be used as part of the expression evaluation. These methods are not declared on the rootObject being passed to Expression.getValue method.

One solution is to add our own MethodResolver to the list of resolvers on the StandardEvaluationContext. However doing that involves pretty much replicating the entire code of ReflectiveMethodResolver (except where we get methods from type) and then since compareArguments and compareArgumentsVarargs methods on ReflectionHelper are not public and also ReflectiveMethodExecutor class is not public, we need to duplicate lot of code.

However if ReflectiveMethodResolver could call a protected method getMethods(type), a subclass could just override it and provide its own static methods.

I am attaching the updated class as well as a Junit test case.

As we are using 3.0.5 version a backport would be great.


Affects: 3.0.5

Attachments:

Referenced from: commits 90bed97

@spring-projects-issues
Copy link
Collaborator Author

Satyapal Reddy commented

My bad, while in my dev env I am using org.springframework.expression-3.0.5.RELEASE.jar in test/staging env they are using org.springframework.expression-3.0.6.RELEASE.jar. I couldn't edit to change the affects version. If we could get backport on 3.0.6 that would be most ideal for us.

@spring-projects-issues
Copy link
Collaborator Author

Andy Clement commented

Pull request submitted to spring-framework for this change:

#21

It should make Spring 3.1.1 but very unlikely to be backported as it isn't a critical fix.

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Resolved in 90bed97

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.1.1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant