-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2022-12-26-Mon-20:08 Converted into Xml
- Loading branch information
1 parent
f1783be
commit f9cd877
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
|
||
<bean id="memberService" class="hello.core.member.MemberServiceImpl"> | ||
<constructor-arg name="memberRepository" ref="memberRepository" /> | ||
</bean> | ||
|
||
<bean id="memberRepository" class="hello.core.member.MemoryMemberRepository"/> | ||
|
||
<bean id="orderService" class="hello.core.order.OrderServiceImpl"> | ||
<constructor-arg name="memberRepository" ref="memberRepository"/> | ||
<constructor-arg name="discountPolicy" ref="discountPolicy"/> | ||
</bean> | ||
|
||
<bean id="discountPolicy" class="hello.core.discount.RateDiscountPolicy"/> | ||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,4 @@ public DiscountPolicy fixDiscountPolicy() { | |
return new FixDiscountPolicy(); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package hello.core.xml; | ||
|
||
import hello.core.member.MemberService; | ||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.support.GenericXmlApplicationContext; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class XmlAppContext { | ||
|
||
@Test | ||
void xmlAppContext() { | ||
ApplicationContext ac = new GenericXmlApplicationContext("appConfig.xml"); | ||
MemberService memberService = ac.getBean("memberService", MemberService.class); | ||
assertThat(memberService).isInstanceOf(MemberService.class); | ||
} | ||
} |