일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 힘들다
- 더이상의 자세한 설명은 생략한다
- 국비과정
- 음식사진없음
- 힘들어도
- 마무리구원투수내동생땡큐
- 프랑스어배우는이유
- 다먹어치움
- 생산성 #24시간알차게 #올해의시간트레이닝 #셀프코치
- 마케팅클라우드
- 세일즈포스
- 프랑스어기초
- SF
- 윈도우 #크롬탭 #크롭탭복사 #크롬탭복제 #크롬사용법 #크롬꿀팁 #업무꿀팁 #일상꿀팁
- MarketingCloud
- 제목은음식인데
- 셀포
- 프랑스어단어
- 프랑스어
- JPOP
- Today
- Total
뚜벅이
BEAN갖고놀기> XML 탈출하기 by @Component 본문
커피메인
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
|
package anno.main;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import anno.model.Cff;
import anno.model.taiwan.Battery;
public class CffMain {
public static void main(String[] args) {
// TODO Auto-generated method stub
AbstractApplicationContext context =
new ClassPathXmlApplicationContext(
"component_xml/cccc.xml");
for (String string :"amrcn,cflt,crmmcch".split(",")) {
((Cff) context.getBean(string)).getDrink();
}
context.close();
}
}
|
cs |
커피자바메인
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
package anno.model;
import org.springframework.stereotype.Component;
import lombok.Data;
//////커피를 만드세요
////커피 -- 인터페이스
////커피종류 -- 클래스
//아메리카노 - 원두, 물, 가격
//까페라떼 - 원두, 물, 우유, 가격
//카라멜마끼아또 - 원두, 물, 카라멜, 가격
public interface Cff {
void getDrink();
}
@Data
@Component
class Amrcn implements Cff{
String www ="좋은원두";
int water = 300;
int price = 2000;
@Override
public void getDrink() {
System.out.println(www+"로 만든 아메리카노: 물"+water+"mL, 가격:"+2000+"원");
}
}
@Data
@Component
class Cflt implements Cff{
String www ="덜존원두";
int water = 200;
int price = 3000;
int milk =100;
@Override
public void getDrink() {
System.out.println(www+"로 만든 카페라테: 물"+water+"mL,우유"+milk+"mL, 가격:"+2000+"원");
}
}
@Data
@Component
class Crmmcch implements Cff{
String www ="더존원두";
int water = 100;
int price = 8000;
int milk =100;
int crm =100;
@Override
public void getDrink() {
System.out.println(www+"로 만든 카페라테: 물 "+water+"mL,우유 "+milk+"mL,카라멜 "+crm+"mL, 가격:"+2000+"원");
}
}
|
cs |
08:25:44.568 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'samsung'
08:25:44.582 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'camera'
08:25:44.584 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'battery'
08:25:44.585 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'apple'
좋은원두로 만든 아메리카노: 물300mL, 가격:2000원
덜존원두로 만든 카페라테: 물200mL,우유100mL, 가격:2000원
더존원두로 만든 카페라테: 물 100mL,우유 100mL,카라멜 100mL, 가격:2000원
08:25:44.610 [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext - Closing org.springframework.context.support.ClassPathXmlApplicationContext@4d1b0d2a, started on Fri Apr 30 08:25:44 KST 2021