File tree 7 files changed +98
-1
lines changed
src/main/java/com/springcore1/collections/props
META-INF/maven/com.springcore/springcore
com/springcore1/collections/props
7 files changed +98
-1
lines changed Original file line number Diff line number Diff line change
1
+ package com .springcore1 .collections .props ;
2
+
3
+ import org .springframework .context .ApplicationContext ;
4
+ import org .springframework .context .support .ClassPathXmlApplicationContext ;
5
+
6
+ public class App {
7
+ public static void main (String [] args ) {
8
+ ApplicationContext context = new ClassPathXmlApplicationContext ("com/springcore1/collections/props/config.xml" );
9
+ User user =(User ) context .getBean ("nameShikhar" );
10
+ System .out .println (user .getProperties ());
11
+
12
+ }
13
+
14
+ }
Original file line number Diff line number Diff line change
1
+ package com .springcore1 .collections .props ;
2
+
3
+ import java .util .Properties ;
4
+
5
+ public class User {
6
+ private Properties properties ;
7
+
8
+ public Properties getProperties () {
9
+ return properties ;
10
+ }
11
+
12
+ public void setProperties (Properties properties ) {
13
+ this .properties = properties ;
14
+ }
15
+
16
+ public User (Properties properties ) {
17
+ super ();
18
+ this .properties = properties ;
19
+ }
20
+
21
+ public User () {
22
+ super ();
23
+ // TODO Auto-generated constructor stub
24
+ }
25
+
26
+
27
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <beans xmlns =" http://www.springframework.org/schema/beans"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xmlns : context =" http://www.springframework.org/schema/context"
5
+ xmlns : p =" http://www.springframework.org/schema/p"
6
+ xsi : schemaLocation =" http://www.springframework.org/schema/beans
7
+ http://www.springframework.org/schema/beans/spring-beans.xsd
8
+ http://www.springframework.org/schema/context
9
+ http://www.springframework.org/schema/context/spring-context.xsd" >
10
+
11
+
12
+
13
+ <bean class =" com.springcore1.collections.props.User" name =" nameShikhar" >
14
+
15
+ <property name =" properties" >
16
+ <props >
17
+ <prop key =" username" >cratesium</prop >
18
+ <prop key =" password" >*********</prop >
19
+
20
+
21
+ </props >
22
+
23
+
24
+ </property >
25
+ </bean >
26
+
27
+
28
+ </beans >
Original file line number Diff line number Diff line change 1
1
# Generated by Maven Integration for Eclipse
2
- # Sat Aug 10 00:57:07 IST 2024
2
+ # Sat Aug 10 01:03:27 IST 2024
3
3
artifactId =springcore
4
4
groupId =com.springcore
5
5
m2e.projectLocation =/Volumes/project/LearningSpring/springcore1
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <beans xmlns =" http://www.springframework.org/schema/beans"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xmlns : context =" http://www.springframework.org/schema/context"
5
+ xmlns : p =" http://www.springframework.org/schema/p"
6
+ xsi : schemaLocation =" http://www.springframework.org/schema/beans
7
+ http://www.springframework.org/schema/beans/spring-beans.xsd
8
+ http://www.springframework.org/schema/context
9
+ http://www.springframework.org/schema/context/spring-context.xsd" >
10
+
11
+
12
+
13
+ <bean class =" com.springcore1.collections.props.User" name =" nameShikhar" >
14
+
15
+ <property name =" properties" >
16
+ <props >
17
+ <prop key =" username" >cratesium</prop >
18
+ <prop key =" password" >*********</prop >
19
+
20
+
21
+ </props >
22
+
23
+
24
+ </property >
25
+ </bean >
26
+
27
+
28
+ </beans >
You can’t perform that action at this time.
0 commit comments