Closed loudking closed 7 years ago
By default, Spring MVC uses the suffix for content negotiation. .xml
renders an XML response, .json
renders a JSON response.
To overcome, you have to use a pattern like {filename:.+}
.
You can also prevent this by switching off suffix pattern matching.
Include in your configuration:
@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);
}
}
or (XML):
<mvc:annotation-driven>
<mvc:path-matching suffix-pattern="false"/>
</mvc:annotation-driven>
Hi, may I ask how to disable spring boot from cutting off file extension with RequestMapping please?
My code:
With request: localhost:8080/uploaded/a.png or localhost:8080/uploaded/b.jpg
I got logging:
So obviously the file extension is removed by spring boot. How to fix this please?