In a Java Spring Boot application, I define the controllers path in a dedicated properties file. e.g.
@PropertySource("classpath:/my.properties")
@RequestMapping("${controller1.path}")
public class Controller{
@RequestMapping("/dosomething")
public void doSomethingREST(){
}
}
where my.properties
looks like:
controller1.path=rest/path
The path of the REST service will be then http://localhost:8080/rest/path/dosomething
How can I read the path in the unit test class? Should I necessarily write it manually? Suppose that I change it, doesn't seem to be a very flexible approach.
Suggestions to make it more dynamic?
Aucun commentaire:
Enregistrer un commentaire