In my java spring boot project, I have an application-dev.yml file in which there is:
spring:
config:
additional-location: classpath:*-{env}.yml
and another file teacher-dev.yml in the same path in which:
teacher:
name: adam
With use of @Value("${teacher.name}"), the project is failed to run by the exception
Could not resolve placeholder 'teacher.name' in value "${teacher.name}"
However, it runs OK if I revise the teacher-dev.yml file as:
teacher.name: adam
I have checked the document but seems no hints there. How do you resolve it while keeping the additional properties in yaml format to make the project work?
The spring version is 2.7.18.