- Option 01 - Using @Value
@Value( "${jdbc.url:aDefaultUrl}" )
private String jdbcUrl;
Note how the default value is provided
- Option 02 - Using Environment class
@Autowired
private Environment env;
env.getProperty("jdbc.url");
- List of Spring-boot common properties https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
mvn spring-boot:run -Drun.profiles=dev
java -jar -Dspring.profiles.active=dev XXX.jar