Details
-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Repositories
-
Labels:None
Description
It is not possible to return a plain String from a rest controller when it is annotated with @BasePathAwareController.
This normal controller works (but in this controller I for example couldn't inject PersistentEntityResourceAssembler)
@RestController @RequestMapping("${spring.data.rest.base-path}") // to expose under correct basepath public class UserRestController { @RequestMapping("/getStringExample") public @ResponseBody String getStringExample() { return "Some dummy String" } }
But this does not work:
@BasePathAwareController public class UserRestController { @RequestMapping("/getStringExample") public @ResponseBody String getStringExample() { return "Some dummy String" } }
This returns a quoted string. Adding produces = "text/plain" also doesn't help. It doesn't work no matter if you use @ResponseBody or not.
Even when you return a ResponseEntity.ok("Some dummy String"); the result will still be quoted in the final response.
How can I return a plain String (e.g. a token) from a @BasePathAwareController?