SpringBoot How to know which @Value are using default value?

Viewed 136

I have lots of @Value("${aaa.bbb:default} in the source code.

But some properties are missing in *.properties files thus default values are used.

How can I get a list of all the fields whose property is missing and @Value is using default value instead of value in properties file?

I want to know where did spring do the loading of @Value so I can set a breakpoint there.

Or are there any logs warning about this?

1 Answers
  1. You can set breakpoint on this line PropertyPlaceholderHelper.java#L161
  2. Get list of all the properties which are injected using @Value by using Intellij search across project feature and then with the help of spring-boot-actuator get list of properties present in Spring's ConfigurableEnvironment using /env endpoint, any property which is used in @Value but it is not there in actuator response for that property default value will be used.
Related