I have a problem with reading application.properties by @SpringBootTest when I start it with a command:
java "-Dfile.encoding=UTF-8" "-Dallure.results.directory=config/reports/allure" -jar junit-platform-console-standalone-1.11
.4.jar --class-path "target/classes;target/test-classes;target/rest-assured-5.5.0-jar-with-dependencies.jar" --select-package com.myapp --reports-dir=config/reports --details=tree --details-theme=unicode
I pack whole app into fat jar with all dependencies. When I start the test in Intellij by runner on method or class name, all works fine. It reads application.properties in src/main/resources/config, but running by junit-platform-console-standalone doesn't read any properties from application.properties.
What have i tried:
- move application.properties into: src/main/resources, src/test/resources/config, src/test/resources
- add "-Dspring.profile.location=file:./config/application.properties" "-Dspring.profile.location=classpath:/config/application.properties" into running command
- add @TestPropertySource(properties = "spring.config.additional-location=classpath:config/application.properties") @TestPropertySource(locations = "classpath:config/application.properties") over test class