I have developed this @GetMapping RestController and all works fine
@GetMapping(path = {"foo", "bar"})
public ResponseEntity<String> foobar() {
return ResponseEntity.ok("foobar");
}
now I want externalize the values inside the path array using my application.yml file,so I writed
url:
- foo
- bar
and I modified my code in order to use it, but it doesn't work in this two different ways
@GetMapping(path = "${url}")
public ResponseEntity<String> foobar() {
return ResponseEntity.ok("foobar");
}
@GetMapping(path = {"${url}"})
public ResponseEntity<String> foobar() {
return ResponseEntity.ok("foobar");
}
I don't understand if the application properties are not correctly formatted or I need to use the SpEL (https://docs.spring.io/spring/docs/3.0.x/reference/expressions.html.
I also want that the code is dynamic according to the application.yml properties, so if the url values increase or decrease the code must still work.
I'm using Springboot 1.5.13