throw exceptions for unknown Spring properties

195 views Asked by At

I made a very silly mistake in my Spring Boot app's YAML config:

---
spring:
    profiles: local
...
___
spring:
    profiles: foo
...
---
spring:
    profiles:
        active: bar
        include: foo
...

I accidentally tried to use "spring.profiles.active" to set the Spring profiles in the last section. Since this does not mean anything to Spring, the last section was always applied and the foo profile was always turned on.

spring.profiles.active is essentially nonsense, yet the app ran without complaint (until the problematic configuration caused other problems).

I would like to configure Spring somehow to immediately throw an exception when it encounters a config parameter that appears internal (spring...) but is unknown to it. How do I do this?

0

There are 0 answers