Why is Spring Boot not reading from default application.properties file

spring boot application.properties not loading intellij
spring boot application.properties example
how to load external properties file in spring boot
class path resource [application.properties] cannot be opened because it does not exist
not able to read properties file in spring boot
how to read application.properties in spring boot
spring boot test not reading application properties
how to read values from properties file in jsp spring boot

I have created a brand new project with spring boot initializr but it doesn't seem to be reading application.properties (in src\main\resources). No matter what level I set my log level to, I don't see a change in the output. Any Idea why it's not reading it?


plugins {
    id 'org.springframework.boot' version '2.1.9.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'

group = 'com.cookbook'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    runtimeOnly 'com.h2database:h2'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'



Not sure but if youusing Intellij-Idea then set the "-Dlogging.level.org.springframework.web=DEBUG" in VM Options instead of putting the option in application.properties file.

Spring Boot app: Not picking up application.properties?, Spring Boot now is not adding default locations to search. Solution: Watch your property under target/classes/application.properties file. folder so I am adding annotation @PropertySource to read these property files. I'm trying to configure a DynamoDb client with Spring Boot, and placed my endpoints and configuration information in my resources/application.properties file. However, Spring Boot does not seem to pick up these properties.

I found that by closing intellij then deleting .gradle folder then re-importing resolved the issue.

Spring Boot application.properties file, I'm not going to discuss properties specified by the Spring Boot framework. Working with existing If that's what you're looking for, keep on reading. Creating application.properties in default location. Spring Boot loads the application.properties file automatically from the project classpath. All you have to​  Configuration Properties Not Loading in Spring Boot Test 04 August 2018 · 2 min read While trying to test a service layer class which loads properties from a configuration file that reads the information from either an application.yml or a application.properties , I kept running into an issue in which all of the properties were returning null .

Make sure you don't have spring.profiles set in application.properties. If yes remove it, it will use the default properties file.

Getting Started, The properties to configure the Config of the application's configuration is read The following listing shows that file: with Spring MVC and Spring Boot. By default, the configuration values are read on the client's startup and not again. I first thought that using @PropertySource("classpath:test.properties") in the TestConfig class would do the trick, but these properties will not overwrite the application.properties settings (see Spring-Boot Reference Doc - 23. Externalized Configuration).

68. Properties & configuration, By default properties from different sources are added to the Spring Environment in a defined spring.config.name ( SPRING_CONFIG_NAME ), defaults to application as the root of the file name. Spring Boot logs the configuration files that are loaded at DEBUG level and the candidates it has not found at TRACE level. Make sure that once you update the application.properties file then need restart the application to apply those changes. Spring boot provides multiple ways to read application.properties or application.yml files: Spring boot can read application properties file using org.springframework.core.env. Environment

24. Externalized Configuration, Spring Boot uses a very particular PropertySource order that is designed to allow If you don't like application.properties as the configuration file name you can switch to java -jar myproject.jar --spring.config.location=classpath:/default.​properties Extra care is required when configuring lists that way as overriding will not  Creating application.properties in default location. Spring Boot loads the application.properties file automatically from the project classpath. All you have to do is to create a new file under the src/main/resources directory. The application.properties file is just a regular text file.

24. Externalized Configuration - Project Metadata API Guide, Spring Boot uses a very particular PropertySource order that is designed to allow If you do not like application.properties as the configuration file name, you can switch java -jar myproject.jar --spring.config.location=classpath:/default.​properties A read timeout of 500ms can be specified in any of the following form: 500  One handy feature of Spring Boot is externalized configuration and easy access to properties defined in properties files. An earlier article described various ways in which this can be done. We are now going to explore the @ConfigurationProperties annotation in greater detail.

  • logging.level.org.springframework.web=DEBUG applies DEBUG level for packages org.springframework.web* If you need to see from DEBUG logs from your application packages (com.cookbook*) set logging.level.com.cookbook=DEBUG
  • The console logs. The logs display INFO level logs even when I have DEBUG or ERROR in the properties file.
  • I've tried logging.level.org.springframework and logging.level.com.cookbook as well but neither show the DEBUG logs when spring starts. It also doesn't seem to be reading my H2Database properties when I add them in.
  • Is the behavior consistent when invoked via command line? (Try doing gradle bootRun.) Just to rule out problems with the IDE
  • I run an older version of IntelliJ for which Gradle support is poor. You could try switching to maven instead. It has great support for it in my view.