Given a \"standard\" spring boot application with a @RestController
, eg
@RestController
@RequestMapping(value = \"foo\", produces = \"applicatio
I assume this question comes from the fact that you are using different application.properties files for your different enviroments. In this case you can use spring profiles and separate configurations into different files with profile name suffix for example:
application.properties:
spring.profiles.active=@activatedProperties@
application-local.properties:
//some config
application-prod.properties:
//some config
then in your build paramethers you can specify which enviroment are you building by adding option:
-Dspring.profiles.active= //<-put here profile local or prod
then in your application you can enable/disable any spring bean by adding
@Profile("put here profile name")
for example:
@RestController
@Profile("local")
@RequestMapping("/testApi")
public class RestForTesting{
//do some stuff
}
now my RestForTesting will be created only if im running a build created with
-Dspring.profiles.active=local