Search This Blog

Friday, April 3, 2020

Spring Boot application.yml

Make sure your pom.xml

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
<include>**/*.yml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


OR

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


GlobalProperties.java

@Component
@ConfigurationProperties ( "product" )
public class GlobalProperties
{
String url;
          //setter, getter
}


application.yml

product:
      url: "http://url.com"

No comments:

Hit Counter


View My Stats