forked from NeilAlishev/SpringCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpringConfig.java
More file actions
32 lines (27 loc) · 734 Bytes
/
SpringConfig.java
File metadata and controls
32 lines (27 loc) · 734 Bytes
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
package ru.alishev.springcourse;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* @author Neil Alishev
*/
@Configuration
@PropertySource("classpath:musicPlayer.properties")
public class SpringConfig {
@Bean
public ClassicalMusic classicalMusic() {
return new ClassicalMusic();
}
@Bean
public RockMusic rockMusic() {
return new RockMusic();
}
@Bean
public MusicPlayer musicPlayer() {
return new MusicPlayer(rockMusic(), classicalMusic());
}
@Bean
public Computer computer() {
return new Computer(musicPlayer());
}
}