Describe the bug
We are using spring-cloud-config-server (4.1.1) to load environment configuration from s3 repository. We are getting intermittent failure with 403 error during a refresh call (http://
exception.message: "Name for argument of type [java.lang.String] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag." exception.stacktrace: "java.lang.IllegalArgumentException: Name for argument of type [java.lang.String] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag. at org.springframework.web.method.annotati…ctor.lambda$createCacheFilter$3(HandlerMappingIntrospector.java:195) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:113) at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:" exception.type: "java.lang.IllegalArgumentException"
The error occurs due to invocation of following method (EnvironmentController.defaultLabelIncludeOrigin)).
It seems the parameter names are not retained which causes the above failure. As per spring 6.1 release notes it has been mentioned to pass following parameter in maven compiler plugin "
@GetMapping(path = "/{name}/{profiles:(?!.\b\.(?:ya?ml|properties|json)\b).}", produces = EnvironmentMediaType.V2_JSON) public Environment defaultLabelIncludeOrigin(@PathVariable String name, @PathVariable String profiles) { return getEnvironment(name, profiles, null, true); }
Spring 6.1 release notes reference
https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.1-Release-Notes
LocalVariableTableParameterNameDiscoverer has been removed in 6.1. Consequently, code within the Spring Framework and Spring portfolio frameworks no longer attempts to deduce parameter names by parsing bytecode. If you experience issues with dependency injection, property binding, SpEL expressions, or other use cases that depend on the names of parameters, you should compile your Java sources with the common Java 8+ -parameters flag for parameter name retention (instead of relying on the -debug compiler flag) in order to be compatible with StandardReflectionParameterNameDiscoverer
Comment From: cloudbackenddev
Able to resolve by having a CustomEnvironmentController with same path mapping but different root context which delegates to EnvironmentController.