application.properties file in SpringBoot

  • Spring Boot comes with a built-in mechanism for application configuration using a file called application.properties
  • You can find the configuration keys in the official documentation as well

Basics of application.properties :

  • The application.properties file is nothing more than simple key-value storage for configuration properties.
  • We can bundle the configuration file in your application jar or put the file in the filesystem of the runtime environment and load it on Spring Boot startup.
  • Using this file we can configure the spring boot framework
  • Define the application custom configuration properties
  • Spring Boot loads the application.properties file automatically from the project classpath, all we have to do is to create application.properties file under src/main/resources directory.

Common application.properties configuration

server.port=9090
logging.level.org.springframework=DEBUG

Injecting properties with @Value

Environment specific application.properties file

Externalising application.properties file

Leave a Comment