Why does my spring boot web application fail to load its configuration properties?

I have created a trivial example spring boot web application and it is running well. That is, the web application starts, the controllers respond to requests by calling services and returning results. I am now trying to add configuration via an application.properties file and I simply cannot get it to load.

I am using Spring Boot 2, Spring 5, Eclipse and Maven. My pom.xml contains:



org.springframework.boot

spring-boot-starter-web

2.0.1.RELEASE



My web application class is:

@SpringBootApplication(scanBasePackages="com.example.root")

public class ExampleWebApp {

public static void main(String[] args) {

SpringApplication.run(ExampleWebApp.class, args);

}

}

My service class where I try and load the environment is:

@Service

public class DataService...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts