Spring tips

From DarkWiki
Revision as of 07:22, 5 July 2017 by Apowney (talk | contribs) (@Value)
Jump to: navigation, search

@Value

Apply a setting, defaulting to a subdirectory of the temporary folder.

    @Value("${prop.name:#{systemProperties['java.io.tmpdir']+'/subdir'}}")
    private String localDir;

When a value is not present in the application.properties file, assume null.

    @Value("${prop.name:#{null}}")
    private String remoteUrl;