This test can be used to validate spring boot (or other) yml files as part of the compilation process. It is primarily aimed at validating basic markup errors and does not know anything about how the properties are actually ued. This test should work on all yml files
- Copy the test class ValidateSpringYml from src/test/java/org/springframework/beans/factory/config to the same package location in your project's test source tree.
- Edit the @Test methods to meet your needs. Alternatively, retain validateAllYml() which will validate all application and test yml files.
Logging output does not appear on the console when running gradle test. Logging output is available at
- build/reports/test/classes as html
- buld/test-results/test as xml
- This project contains one good and one bad yml file. The "*" test fails because int validates all yml files on the path including the bad yml file in src/test/resources
- The test class must be in the spring package because it accesses protected code.
This project was built with the following
- Java 8
- Gradle 4.2
- You can crate a gradle wrapper by running the following command
gradle wrapper --gradle-version 4.2
- This project created with Spring starter
- Information about application.properties and application.yml files available in spring external configuration documentation
- Git repository created using this git tutorial