diff --git a/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/yamlmap/factory/YamlPropertySourceFactory.java b/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/yamlmap/factory/YamlPropertySourceFactory.java deleted file mode 100644 index e46f7c9cba..0000000000 --- a/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/yamlmap/factory/YamlPropertySourceFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.properties.yamlmap.factory; - -import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; -import org.springframework.core.env.PropertiesPropertySource; -import org.springframework.core.env.PropertySource; -import org.springframework.core.io.support.EncodedResource; -import org.springframework.core.io.support.PropertySourceFactory; - -import java.io.IOException; -import java.util.Properties; - -public class YamlPropertySourceFactory implements PropertySourceFactory { - - @Override - public PropertySource createPropertySource(String name, EncodedResource encodedResource) throws IOException { - YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean(); - factory.setResources(encodedResource.getResource()); - - Properties properties = factory.getObject(); - - return new PropertiesPropertySource(encodedResource.getResource() - .getFilename(), properties); - } - -} diff --git a/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/yamlmap/pojo/ServerProperties.java b/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/yamlmap/pojo/ServerProperties.java index 38b44fddc7..9d54daf070 100644 --- a/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/yamlmap/pojo/ServerProperties.java +++ b/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/yamlmap/pojo/ServerProperties.java @@ -4,13 +4,9 @@ import java.util.List; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; -import com.baeldung.properties.yamlmap.factory.YamlPropertySourceFactory; - @Component -@PropertySource(value = "classpath:server.yml", factory = YamlPropertySourceFactory.class) @ConfigurationProperties(prefix = "server") public class ServerProperties { diff --git a/spring-boot-modules/spring-boot-properties-2/src/main/resources/server.yml b/spring-boot-modules/spring-boot-properties-2/src/main/resources/application.yml similarity index 100% rename from spring-boot-modules/spring-boot-properties-2/src/main/resources/server.yml rename to spring-boot-modules/spring-boot-properties-2/src/main/resources/application.yml