What annotation do you use to quickly switch between different environments to load different configurations?
@Profile is used to quickly switch between different environments to load different configurations.
-
Add
@Profileannotation to the configuration class.@Configuration @Profile("dev") public class DevConfig { // ... @Value("${spring.datasource.url}") private String url; } -
Add
spring.profiles.activeinapplication.propertiesfile.spring.profiles.active=dev
What is Jasypt?
Jasypt is a java library which allows the developer to perform encryption and decryption in Java application. Such as password, database connection strings, etc.