I suppose that it reads in work working contour and then it reads in testing contour.
If application.yml is in testing contour , it settings replace the settings has been reading in application.yml of working contour. If You have defined application-test.yml and you point above a class an annotation @SpringBootTest and above @ActiveProfile("test") then the settings from application-test.yml replaces earlier settings.
what do you think about all this ? How to understand this process correctly?
CodePudding user response:
you have to put this in your application-test.yml
spring:
profiles: test
CodePudding user response:
According to Spring Boot reference documentation, the configuration data files are considered in the following order:
- Application properties packaged inside your jar (application.properties and YAML variants).
- Profile-specific application properties packaged inside your jar (application-{profile}.properties and YAML variants).
- Application properties outside of your packaged jar (application.properties and YAML variants).
- Profile-specific application properties outside of your packaged jar (application-{profile}.properties and YAML variants).