Closed sunmingtao closed 3 years ago
Turns out by default the content type is "application/json".
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer
.ignoreAcceptHeader(true)
.defaultContentType(MediaType.APPLICATION_JSON, MediaType.ALL)
.mediaType("json", MediaType.APPLICATION_JSON);
}
The fix is overwrite the content type:
@GetMapping(value = "/menu", produces = "application/javascript; charset=utf-8")
public String getDeliverySystemMenu() {
return "...";
}
Send an ajax request to following route: