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

DefaultParameterNameDiscoverer should automatically adapt to Graal constraints [SPR-17005] #21543

Closed
spring-projects-issues opened this issue Jul 4, 2018 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 4, 2018

Dave Syer opened SPR-17005 and commented

ParameterNameDiscoverer is used in a number of places in Spring, not least of which is in the core DI features. AbstractAutowireCapableBeanFactory exposes a setter and a getter, but it's not available in any public interfaces that are easy to access, so it seems like you have to resort to downcasting:

((AbstractAutowireCapableBeanFactory) context.getDefaultListableBeanFactory())
		.setParameterNameDiscoverer(...);

MVC and Webflux also use parameter name discovery for controller methods. This can be avoided if users explicitly add annotations, or simply don't use the flexible method signature features.

The default parameter name discoverer uses reflection and also ASM, and both of these strategies is problematic or unavailable in native images (c.f. GraalVM). It seems like the AbstractAutowireCapableBeanFactory actually works fine with a NoopParameterNameDiscoverer (that just returns null), unless it has to do autowire by name (which is pretty uncommon I should think).


Issue Links:

Referenced from: commits e8034f2

@spring-projects-issues
Copy link
Collaborator Author

Sébastien Deleuze commented

Resolved by using no ParameterNameDiscoverer with Graal native images via org.graalvm.nativeimage.imagecode system property (which is considered as a public API) as advised by GraalVM team, see ImageInfo.java.

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) in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants