Spring Boot YAML binding: fail when using yml extension

Viewed 16

i cannot start my spring-boot application, because an exception with the following messagge is thrown"Error creating bean with name 'application': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'tracer.datadog' in value

The reason is that spring-boot cannot find the "tracer.datadog" prop specificied on the application class:

@SpringBootApplication
@EnableMongoAuditing
public class Application {

    @Value("${tracer.datadog}")
    private boolean datadog;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @PostConstruct
    private void jaegerTracer() {
        if (!datadog) {
            GlobalTracer.registerIfAbsent(Configuration.fromEnv().getTracer());
        }
    }

}

But that property is correctly defined over the application.yml file:

tracer:
  datadog: true

However, changing the extension to .YAML spring-boot "find" the file and the application starts fine.
Does anyone can tell me how can i do to solve this problem and use the .yml extension? using the .yaml extension is not a possibility because of company standards

0 Answers
Related