The @value annotation of springboot adds the default value to solve the startup error caused by the non-existent key

@value injection, when the configuration file cannot be submitted

If the configuration file of a multi-person collaborative development project is not submitted, it will cause the startup of other people’s projects to fail. You can provide a default value for the class attribute @value

1
2
3
4
5
//The null value is wrapped in #{}, if not parsed as a string by default
@Value("${cpris.docRootPath:#{null}}")
private String rootPath;
@Value("${cpris.ip:1}")
private String ip;


Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *