Difference between revisions of "Spring tips"

From DarkWiki
Jump to: navigation, search
(@Value)
Line 14: Line 14:
 
     private String remoteUrl;
 
     private String remoteUrl;
 
</source>
 
</source>
 +
 +
==Configuration==
 +
 +
A list of configuration properties can be found here: https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

Revision as of 13:26, 25 October 2017

@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;

Configuration

A list of configuration properties can be found here: https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html