Skip to content

Instantly share code, notes, and snippets.

@shaunthomas999
Last active December 7, 2017 11:13
Show Gist options
  • Save shaunthomas999/8720504c0b14cd3e59d17405f2146709 to your computer and use it in GitHub Desktop.
Save shaunthomas999/8720504c0b14cd3e59d17405f2146709 to your computer and use it in GitHub Desktop.
Spring-Boot Notes

Spring-Boot Notes

Properties

  • Option 01 - Using @Value
@Value( "${jdbc.url:aDefaultUrl}" )
private String jdbcUrl;

Note how the default value is provided

  • Option 02 - Using Environment class
@Autowired
private Environment env;

env.getProperty("jdbc.url");

Reference

Profiles

  • mvn spring-boot:run -Drun.profiles=dev
  • java -jar -Dspring.profiles.active=dev XXX.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment