Issue
I import a dependency that have some services with @Value
fields. In my spring boot application I don't use these services but I still use some other classes from this dependency, now if I run my application it will fail that it can't resolve the placeholders, e.g.
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'apn.authentication.token.teamId' in value "${apn.authentication.token.teamId}"
So to fix this I have to define the value in my properties. I searched for a setting to let my app not fail on unknown values but I couldn't find a way to do it.
Is there a way to let my spring boot app launch even if there are missing values? Or Should I exclude the classes that I don't use (and how if this is the only option)?
Solution
You can set some default values so that if the value does not present it takes the default value
@Value("${apn.authentication.token.teamId:-99}")
private int teamId;
or to set value as null
@Value("${apn.authentication.token.teamId:#{null}}")
private Integer teamId;
Answered By - Debopam