sitelink1  
sitelink2  
sitelink3  
extra_vars6  
·미리보기 | 소스복사·
 
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2.  
    이 화일은 JPetStore의 비즈니스 레이어를 담당하는 설정화일이다.
  3. <!--   
  4.   - Application context definition for JPetStore's business layer.   
  5.   - Contains bean references to the transaction manager and to the DAOs in   
  6.   - dataAccessContext-local/jta.xml (see web.xml's "contextConfigLocation").   
  7.   -->  
  8. <beans xmlns="http://www.springframework.org/schema/beans"  
  9.          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  10.          xmlns:aop="http://www.springframework.org/schema/aop"  
  11.          xmlns:tx="http://www.springframework.org/schema/tx"  
  12.          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd   
  13.            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd   
  14.            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">  
  15.   
  16.   
  17.     <!-- ========================= GENERAL DEFINITIONS ========================= -->  
    데이터베이스와 메일의 설정
  18.     <!-- Configurer that replaces ${...} placeholders with values from properties files -->  
  19.     <!-- (in this case, mail and JDBC related properties) -->  
  20.     <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
  21.         <property name="locations">  
  22.             <list>  
  23.                 <value>WEB-INF/mail.properties</value>  
  24.                 <value>WEB-INF/jdbc.properties</value>  
  25.             </list>  
  26.         </property>  
  27.     </bean>  
  28.   
  29.     <!-- MailSender used by EmailAdvice -->  
  30.     <!--   
  31.     <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">  
  32.         <property name="host" value="${mail.host}"/>  
  33.     </bean>  
  34.     -->  
  35.   
  36.   
  37.     <!-- ========================= BUSINESS OBJECT DEFINITIONS ======================== -->  
    Account와 Order 객체에 대한 validator 설정이다.
  38.     <!-- Generic validator for Account objects, to be used for example by the Spring web tier -->  
  39.     <bean id="accountValidator" class="org.springframework.samples.jpetstore.domain.logic.AccountValidator"/>  
  40.   
  41.     <!-- Generic validator for Order objects, to be used for example by the Spring web tier -->  
  42.     <bean id="orderValidator" class="org.springframework.samples.jpetstore.domain.logic.OrderValidator"/>  
  43.   
    PetStoreImpl클래스는 JPetStore 기본 비즈니스 객체로써 PetStoreFacade, OrderService 인터페이스를 상속받고 있다.
    그리고 트랜잭션 처리를 위해 이하의 AOP설정을 수행하고 있다.
    PetStoreFacade 인터페이스는 Account, Category, Product, Item, Order 객체들을 얻어오는 데에 필요한 여러가지 메소드들을 준비해 두고 있다.
    이름에도 나와 있지만 각 객체들의 Controller들은 Facade 패턴의 형태로 이 인터페이스를 통해서 객체들을 얻어와 사용하고 있다.
    OrderService 인터페이스는 JaxRpcOrderService 클래스에서 상속받아 구현하고 있다.
    JaxRpcOrderService클래스를 보니 주석의 내용이 너무 길게 적혀있다.
    /**
     * JAX-RPC OrderService endpoint that simply delegates to the OrderService implementation in the root web application context.
     * Implements the plain OrderService interface as service interface, just like the target bean does.
     * <p>This proxy class is necessary because JAX-RPC/Axis requires a dedicated endpoint class to instantiate.
     * If an existing service needs to be exported, a wrapper that extends ServletEndpointSupport for simple application context access is the simplest JAX-RPC compliant way.
     * <p>This is the class registered with the server-side JAX-RPC implementation.
     * In the case of Axis, this happens in "server-config.wsdd" respectively via deployment calls.
     * The Web Service tool manages the lifecycle of instances of this class: A Spring application context can just be accessed here.
     * <p>Note that this class does <i>not</i> implement an RMI port interface, despite the JAX-RPC spec requiring this for service endpoints.
     * Axis and other JAX-RPC implementations are known to accept non-RMI endpoint classes too, so there's no need to maintain an RMI port interface in addition to the existing non-RMI service interface (OrderService).
     * <p>If your JAX-RPC implementation imposes a strict requirement on a service endpoint class to implement an RMI port interface, then let your endpoint class implement both the non-RMI service interface and the RMI port interface.
     * This will work as long as the methods in both interfaces just differ in the declared RemoteException.
     * Of course, this unfortunately involves double maintenance: one interface for your business logic, one for JAX-RPC.
     * Therefore, it is usually preferable to avoid this if not absolutely necessary.
     * @author  Juergen Hoeller
     * @since  26.12.2003
     */
    이거 해석하려면 한시간 걸리겠다. 나중에 하기로 하고, 다음을 살펴보자.
    검색해보면 OrderServiceClient라는 클래스도 OrderService와 관련이 있다.
    OrderServiceClient클래스는 remote OrderServices에 대한 데모 클래스로써
    jpetstoreclient 경로에 위치한 client.bat을 실행한다.
    이것도 보다 자세한건 추후로 미루고...ㅜ_ㅜ
    PetStoreImpl클래스에 대해서 인터넷에 검색해보니 다음과 같은 내용이 있었다.
    실제 업무시스템을 개발하다보면 dao객체가 위처럼 5개만 나오지는 않거든여.
    Service객체도 마찬가지고여.
    그렇다면 위의 PetStoreImpl 같은 객체를 만들면 그 객체가 엄청나게 커져버리고 수정에 대한 부담도 증가할 것 같고여
    (여러개를 만들어도 시스템이 크면 그럴 것같네여)
    그렇지 않고 Service객체별로 트랜잭션 설정을 하게 되면
    엄청나게 많은 bean 설정이 추가되어야 하게 될텐데여...
    다른 좋은 방법이 없을까여? ^^
    이에 대한 답변으로는 XDoclet이 있었고, 오토프락시팩토리라는게 있었다.
    오토프락시팩토리? 머지? 공부할거 투성이군...
  44.     <!--   
  45.       - JPetStore primary business object (default implementation).   
  46.         - Transaction advice gets applied through the AOP configuration below.   
  47.         -->  
  48.     <bean id="petStore" class="org.springframework.samples.jpetstore.domain.logic.PetStoreImpl">  
  49.         <property name="accountDao" ref="accountDao"/>  
  50.         <property name="categoryDao" ref="categoryDao"/>  
  51.         <property name="productDao" ref="productDao"/>  
  52.         <property name="itemDao" ref="itemDao"/>  
  53.         <property name="orderDao" ref="orderDao"/>  
  54.     </bean>  
  55.   
  56.   
  57.     <!-- ========================= ASPECT CONFIGURATION ======================== -->  
  58.   
  59.     <aop:config>  
  60.         <!--   
  61.             This definition creates auto-proxy infrastructure based on the given pointcut,   
  62.             expressed in AspectJ pointcut language. Here: applying the advice named   
  63.             "txAdvice" to all methods on classes named PetStoreImpl.   
  64.         -->  
  65.         <aop:advisor pointcut="execution(* *..PetStoreFacade.*(..))" advice-ref="txAdvice"/>  
  66.   
  67.         <!--   
  68.             This definition creates auto-proxy infrastructure based on the given pointcut,   
  69.             expressed in AspectJ pointcut language. Here: applying the advice named   
  70.             "emailAdvice" to insertOrder(Order) method of PetStoreImpl   
  71.         -->  
  72.         <!--  
  73.         <aop:advisor pointcut="execution(* *..PetStoreFacade.insertOrder(*..Order))" advice-ref="emailAdvice"/>  
  74.         -->  
  75.     </aop:config>  
  76.   
  77.     <!--   
  78.         Transaction advice definition, based on method name patterns.   
  79.         Defaults to PROPAGATION_REQUIRED for all methods whose name starts with   
  80.         "insert" or "update", and to PROPAGATION_REQUIRED with read-only hint   
  81.         for all other methods.   
  82.     -->  
  83.     <tx:advice id="txAdvice">  
  84.         <tx:attributes>  
  85.             <tx:method name="insert*"/>  
  86.             <tx:method name="update*"/>  
  87.             <tx:method name="*" read-only="true"/>  
  88.         </tx:attributes>  
  89.     </tx:advice>  
  90.   
  91.     <!-- AOP advice used to send confirmation email after order has been submitted -->  
  92.     <!--   
  93.     <bean id="emailAdvice" class="org.springframework.samples.jpetstore.domain.logic.SendOrderConfirmationEmailAdvice">  
  94.         <property name="mailSender" ref="mailSender"/>  
  95.     </bean>-->  
  96.   
  97.   
  98.     <!-- ========================= REMOTE EXPORTER DEFINITIONS ======================== -->  
  99.   
  100.     <!-- RMI exporter for the JPetStore OrderService -->  
  101.     <!-- Commented out by default to avoid conflicts with EJB containers -->  
  102.     <!--   
  103.     <bean id="order-rmi" class="org.springframework.remoting.rmi.RmiServiceExporter">  
  104.         <property name="service" ref="petStore"/>  
  105.         <property name="serviceInterface" value="org.springframework.samples.jpetstore.domain.logic.OrderService"/>  
  106.         <property name="serviceName" value="order"/>  
  107.         <property name="registryPort" value="1099"/>  
  108.     </bean>  
  109.     -->  
  110.   
  111. </beans>  
번호 제목 글쓴이 날짜 조회 수
공지 (확인전) [2021.03.12] Eclipse에서 Spring Boot로 JSP사용하기(Gradle) 황제낙엽 2023.12.23 0
공지 [작성중/인프런] 스프링부트 시큐리티 & JWT 강의 황제낙엽 2023.12.20 6
83 java.util.MissingResourceException: Can't find bundle for base name xxx, locale ko_KR 황제낙엽 2007.06.21 2362
82 [Spring3.1.1][1] RestTemplate 한글 문제 황제낙엽 2018.08.08 683
81 Spring WebFlow Introduction (웹개발을 직관적으로) 황제낙엽 2006.12.09 555
80 Spring Security OAuth2구현 file 황제낙엽 2019.09.05 462
79 Spring Security OAuth 황제낙엽 2019.09.05 435
78 <spring:checkbox> tip! 황제낙엽 2007.10.01 378
77 [Spring3.1.1][3] RestTemplate 한글 문제 황제낙엽 2018.08.08 237
76 Spring MVC 가 아닌 환경에서 Spring Pojo Bean 사용하기 (Pure Java App 또는 Servlet App) 황제낙엽 2009.10.22 233
» Cugain의 샘플프로젝트 jpetstore 분석기 - (5) applicationContext.xml 분석 황제낙엽 2007.04.21 232
74 스프링 개발팁 황제낙엽 2007.08.17 223
73 Spring Boot에서의 RESTful API 모듈 file 황제낙엽 2020.04.16 216
72 SimpleFormController 정리 황제낙엽 2007.09.19 206
71 Spring 과 Spring Boot의 차이 file 황제낙엽 2020.05.26 202
70 Spring의 Exception 황제낙엽 2007.09.17 194
69 Spring MVC 어플리케이션 개발 <11> 간단한 조회 구현 방안 비교 황제낙엽 2007.05.27 164
68 스프링 2와 JPA 시작하기 (한글) 황제낙엽 2007.08.27 142
67 [Spring3.1.1] ResponseBody 한글깨짐 해결법 황제낙엽 2018.08.08 140
66 웹 개발의 변화와 스프링 황제낙엽 2008.03.19 132
65 Spring AOP - Pointcut 황제낙엽 2007.10.02 129
64 유효성체크 (org.springframework.validation.Validator) 황제낙엽 2007.08.17 129