From f9cd8772b01345b6198db312298c81574f2f525f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=8A=B9=EC=9D=80?= Date: Mon, 26 Dec 2022 20:09:07 +0900 Subject: [PATCH] 2022-12-26-Mon-20:08 Converted into Xml --- src/main/resources/appConfig.xml | 18 ++++++++++++++++++ .../ApplicationContextExtendsFindTest.java | 2 -- .../java/hello/core/xml/XmlAppContext.java | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/appConfig.xml create mode 100644 src/test/java/hello/core/xml/XmlAppContext.java diff --git a/src/main/resources/appConfig.xml b/src/main/resources/appConfig.xml new file mode 100644 index 0000000..22b6d69 --- /dev/null +++ b/src/main/resources/appConfig.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/hello/core/beanfind/ApplicationContextExtendsFindTest.java b/src/test/java/hello/core/beanfind/ApplicationContextExtendsFindTest.java index 0fffb48..acf639a 100644 --- a/src/test/java/hello/core/beanfind/ApplicationContextExtendsFindTest.java +++ b/src/test/java/hello/core/beanfind/ApplicationContextExtendsFindTest.java @@ -73,6 +73,4 @@ public DiscountPolicy fixDiscountPolicy() { return new FixDiscountPolicy(); } } - - } diff --git a/src/test/java/hello/core/xml/XmlAppContext.java b/src/test/java/hello/core/xml/XmlAppContext.java new file mode 100644 index 0000000..d0f6c6a --- /dev/null +++ b/src/test/java/hello/core/xml/XmlAppContext.java @@ -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); + } +}