spring boot application.properties code example

Example 1: How to access a value defined in the application.properties file in Spring Boot

@Value("${userBucket.path}")
private String userBucketPath;
(Assumes you have a property in application.properties called userbucket.path)

Example 2: application.properties spring boot mysql

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/db_example
spring.datasource.username=springuser
spring.datasource.password=ThePasswordCopy

Tags:

Java Example