C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Spring Boot Application PropertiesSpring Boot Framework comes with a built-in mechanism for application configuration using a file called application.properties. It is located inside the src/main/resources folder, as shown in the following figure. Spring Boot provides various properties that can be configured in the application.properties file. The properties have default values. We can set a property(s) for the Spring Boot application. Spring Boot also allows us to define our own property if required. The application.properties file allows us to run an application in a different environment. In short, we can use the application.properties file to:
Example of application.properties#configuring application name spring.application.name = demoApplication #configuring port server.port = 8081 In the above example, we have configured the application name and port. The port 8081 denotes that the application runs on port 8081. Note: The lines started with # are comments.YAML Properties File Spring Boot provides another file to configure the properties is called yml file. The Yaml file works because the Snake YAML jar is present in the classpath. Instead of using the application.properties file, we can also use the application.yml file, but the Yml file should be present in the classpath. Example of application.yml spring: application: name: demoApplication server: port: 8081 In the above example, we have configured the application name and port. The port 8081 denotes that the application runs on port 8081. Spring Boot Property CategoriesThere are sixteen categories of Spring Boot Property are as follows:
Application Properties TableThe following tables provide a list of common Spring Boot properties:
Next TopicSpring Boot Starters
|