I have problem when trying to create get method which allows dots as a parameter.
@GetMapping(path = "test/{id:.+}")
@ResponseBody
public String getTest(@PathVariable String id) {
return id;
}
So it works for example for path
test/core.txt
But it does not for
test/core.something
I got error like
{
"timestamp": 1623837131322,
"status": 500,
"error": "Internal Server Error",
"exception": "java.lang.NoClassDefFoundError",
"message": "Could not initialize class org.springframework.web.accept.PathExtensionContentNegotiationStrategy$ActivationMediaTypeFactory",
"path": "/api/v1/test/core.somethign"
}
java.lang.NoClassDefFoundError: Could not initialize class org.springframework.web.accept.PathExtensionContentNegotiationStrategy$ActivationMediaTypeFactory ...
Also tried to extend WebMvcConfigurationSupport with
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);
}
I am using spring boot version 1.5.22.RELEASE. Do you have any idea what can be wrong, seems like my configuration is ignored somehow
package eu.test;
import org.springframework.context.annotation.*;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
@Configuration
@ComponentScan
@PropertySource(
ignoreResourceNotFound = false,
value = "classpath:application.properties")
public class ApplicationConfiguration extends WebMvcConfigurationSupport {
@Override
protected void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);
}
}