forked from NeilAlishev/SpringCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSpring.java
More file actions
34 lines (24 loc) · 1.01 KB
/
TestSpring.java
File metadata and controls
34 lines (24 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package ru.alishev.springcourse;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Neil Alishev
*/
public class TestSpring {
public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"applicationContext.xml"
);
MusicPlayer firstMusicPlayer = context.getBean("musicPlayer", MusicPlayer.class);
MusicPlayer secondMusicPlayer = context.getBean("musicPlayer", MusicPlayer.class);
boolean comparison = firstMusicPlayer == secondMusicPlayer;
System.out.println(comparison);
System.out.println(firstMusicPlayer);
System.out.println(secondMusicPlayer);
firstMusicPlayer.setVolume(10);
System.out.println(firstMusicPlayer.getVolume());
System.out.println(secondMusicPlayer.getVolume());
//System.out.println(musicPlayer.getName());
//System.out.println(musicPlayer.getVolume());
context.close();
}
}