0
I use:
- spring boot 2.2.4.RELEASE
The need arose for me to use two different paths in my classes annotated with @Restcontroller @Requestmapping, today my application.propeties is as follows:
server.port=8080
spring.mvc.servlet.path=/api-a/v1
However with this need tbm will need to use path: /api-b/v1 in other classes
I can define an initial path for each package? or is there a more correct way to do this type of treatment?
I couldn’t find anything on google that would help me, I found something about decoupling the project and defining different modules with application.properties for each module, but it wasn’t the case of the example I found, as I did not have much success in my search I wonder if someone could help me.
The person gave a slide in my doubt and not to comment what I did wrong to correct my doubt '-'
– Relry Pereira
Why don’t you leave the default context ("/") and set the path
api-a, api-b, api-x
within the @Requestmapping annotation, example:@RequestMapping("/api-a/v1)
?– Andrey França
currently I use this way, but if I need to change the
api-a
to another name I would have to change in all my controllers classes(leaving so susceptible to errors), my application depends on two default path’s that were configured in two different gateways, this is why I have to useapi-a
and theapi-b
.– Relry Pereira