So basically I have my rootFolderId in my application.properties
app.property.rootFolder="some string "
and I need to get it in the Controller
@Value("${app.property.rootFolder}")
private static String rootFolder ;
and use it in @RequestParam like :
@GetMapping({"/list"})
public List<File> list(@RequestParam(defaultValue = rootFolder) String parentId)
{ ..../}
but I get the problem "Attribute value must be constant" .Is there any way to make it work ?
CodePudding user response:
You can use property replacement in the @RequestParam
field. See below.
@GetMapping({"/list"})
public List<File> list(@RequestParam(defaultValue = "${app.property.rootFolder}") String parentId) { ... }