diff --git a/spring-core/pom.xml b/spring-core/pom.xml
index 70002bf3c1..85cf4573aa 100644
--- a/spring-core/pom.xml
+++ b/spring-core/pom.xml
@@ -58,12 +58,17 @@
lombok
${lombok.version}
+
+ org.springframework.boot
+ spring-boot-starter
+ 1.5.2.RELEASE
+
org.springframework.boot
spring-boot-test
${mockito.spring.boot.version}
test
-
+
diff --git a/spring-core/src/main/java/com/baeldung/yaml/MyApplication.java b/spring-core/src/main/java/com/baeldung/yaml/MyApplication.java
new file mode 100644
index 0000000000..4a585df998
--- /dev/null
+++ b/spring-core/src/main/java/com/baeldung/yaml/MyApplication.java
@@ -0,0 +1,31 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.baeldung.yaml;
+
+import java.util.Collections;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class MyApplication implements CommandLineRunner {
+
+ @Autowired
+ private YAMLConfig myConfig;
+
+ public static void main(String[] args) {
+ SpringApplication app = new SpringApplication(MyApplication.class);
+ app.run();
+ }
+
+ public void run(String... args) throws Exception {
+ System.out.println("using environment:" + myConfig.getEnvironment());
+ System.out.println("name:" + myConfig.getName());
+ System.out.println("servers:" + myConfig.getServers());
+ }
+
+}
diff --git a/spring-core/src/main/java/com/baeldung/yaml/YAMLConfig.java b/spring-core/src/main/java/com/baeldung/yaml/YAMLConfig.java
new file mode 100644
index 0000000000..313b920502
--- /dev/null
+++ b/spring-core/src/main/java/com/baeldung/yaml/YAMLConfig.java
@@ -0,0 +1,41 @@
+package com.baeldung.yaml;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@EnableConfigurationProperties
+@ConfigurationProperties
+public class YAMLConfig {
+ private String name;
+ private String environment;
+ private List servers = new ArrayList();
+
+ public List getServers() {
+ return servers;
+ }
+
+ public void setServers(List servers) {
+ this.servers = servers;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(String environment) {
+ this.environment = environment;
+ }
+
+}
diff --git a/spring-core/src/main/resources/application.properties b/spring-core/src/main/resources/application.properties
index fdc6536237..11710b49aa 100644
--- a/spring-core/src/main/resources/application.properties
+++ b/spring-core/src/main/resources/application.properties
@@ -1,2 +1,2 @@
-someInitialValue=This is only sample value
-anotherValue=Another configured value
\ No newline at end of file
+spring.profiles.active=prod
+
diff --git a/spring-core/src/main/resources/application.yml b/spring-core/src/main/resources/application.yml
new file mode 100644
index 0000000000..6fc6f67cd0
--- /dev/null
+++ b/spring-core/src/main/resources/application.yml
@@ -0,0 +1,17 @@
+spring:
+ profiles: test
+name: test-YAML
+environment: test
+servers:
+ - www.abc.test.com
+ - www.xyz.test.com
+
+---
+
+spring:
+ profiles: prod
+name: prod-YAML
+environment: production
+servers:
+ - www.abc.com
+ - www.xyz.com