diff --git a/spring-all/src/main/java/org/baeldung/properties/core/ComponentInXmlUsingProperties.java b/spring-all/src/main/java/org/baeldung/properties/core/ComponentInXmlUsingProperties.java
new file mode 100644
index 0000000000..f695326cd6
--- /dev/null
+++ b/spring-all/src/main/java/org/baeldung/properties/core/ComponentInXmlUsingProperties.java
@@ -0,0 +1,30 @@
+package org.baeldung.properties.core;
+
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.env.Environment;
+
+public class ComponentInXmlUsingProperties implements InitializingBean {
+
+ @Autowired
+ private Environment env;
+
+ @Value("${key.something}")
+ private String injectedProperty;
+
+ public ComponentInXmlUsingProperties(final String propertyValue) {
+ super();
+
+ System.out.println("Constructor Injection - Property Value resolted to: " + propertyValue);
+ }
+
+ //
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ System.out.println("in afterPropertiesSet via @Value: " + injectedProperty);
+ System.out.println("in afterPropertiesSet Environment: " + env.getProperty("key.something"));
+ }
+
+}
diff --git a/spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java b/spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java
index 0269053fbe..9b5d7ed047 100644
--- a/spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java
+++ b/spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java
@@ -7,7 +7,7 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@Configuration
-@ComponentScan("org.baeldung.core")
+@ComponentScan("org.baeldung.properties.core")
@PropertySource("classpath:foo.properties")
public class PropertiesWithJavaConfig {
@@ -18,7 +18,7 @@ public class PropertiesWithJavaConfig {
// beans
@Bean
- public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
+ public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
diff --git a/spring-all/src/main/resources/configForProperties.xml b/spring-all/src/main/resources/configForProperties.xml
index 6ec3d15fe5..fc6cf21069 100644
--- a/spring-all/src/main/resources/configForProperties.xml
+++ b/spring-all/src/main/resources/configForProperties.xml
@@ -6,8 +6,13 @@
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file