← All tutorials

GoCareerGo Tutorials

Spring Boot Tutorial

Auto-configuration, REST APIs, JPA, AOP, caching, microservices and Spring Cloud.

application.properties / application.yml

The default place to externalize configuration — server port, database URL, logging levels and custom app settings.

server.port=8081
spring.datasource.url=jdbc:mysql://localhost:3306/demo
spring.datasource.username=root
spring.datasource.password=secret
spring.jpa.hibernate.ddl-auto=update
logging.level.org.springframework=INFO
  • application.yml is the same idea with YAML's nested, indentation-based syntax
  • Values can be read back with @Value("${server.port}") or a @ConfigurationProperties class
  • Profile-specific files (application-dev.properties) override the base file per environment