1. 소속패키지 : org.springframework.samples.jpetstore.domain.logic
2. 상속받는 인터페이스 : PetStoreFacade.java, OrderService.java
3. 잡담

 

PetStoreFacade와 PetStoreImpl의 관계는 Facade패턴의 관계이다.
이는 PetStoreImpl에 정의된 다음의 메소드로 무엇을 하려는 인터페이스인지 짐작이 가능하다.
·미리보기 | 소스복사·
 
  1. public void insertOrder(Order order) {   
  2.     this.orderDao.insertOrder(order);   
  3.     this.itemDao.updateQuantity(order);   
  4. }  
서로 다른 Dao객체를 통해 Order정보를 저장하는 메소드이다.
이 메소드를 호출하는 클래스에서는 단지 Order객체를 저장하라는 명령만 내리면 된다.
나머지 어떤 테이블에 어떻게 저장하는지는 이 메소드에서 알아서 처리한다는 내용이다.
클래스를 만든 사람이 할 말이 더 많을테니 PetStoreImpl에 주석으로 달려있는 내용을 읽어보자.
/**
 * JPetStore primary business object.
 *
 * <p>This object makes use of five DAO objects, decoupling it
 * from the details of working with persistence APIs. Thus
 * although this application uses iBATIS for data access,
 * another persistence tool could be dropped in without
 * breaking this class.
 *
 * <p>The DAOs are made available to the instance of this object
 * using Dependency Injection. (The DAOs are in turn configured
 * using Dependency Injection.) We use Setter Injection here,
 * exposing JavaBean setter methods for each DAO. This means there is
 * a JavaBean "property" for each DAO. In this case the properties
 * are write-only: there is no getter method to accompany the
 * setter methods. Getter methods are optional: implement them
 * only if you want to expose access to the properties in your
 * business object.
 *
 * <p>There is one instance of this class in the JPetStore application.
 * In Spring terminology, it is a "singleton". This means a
 * per-Application Context singleton. The factory creates a single
 * instance; there is no need for a private constructor, static
 * factory method etc as in the traditional implementation of
 * the Singleton Design Pattern.
 *
 * <p>This is a POJO. It does not depend on any Spring APIs.
 * It's usable outside a Spring container, and can be instantiated
 * using new in a JUnit test. However, we can still apply declarative
 * transaction management to it using Spring AOP.
 *
 * <p>This class defines a default transaction attribute for all methods.
 * Note that this attribute definition is only necessary if using Commons
 * Attributes auto-proxying (see the "attributes" directory under the root of
 * JPetStore). No attributes are required with a TransactionFactoryProxyBean,
 * as in the default applicationContext.xml in the war/WEB-INF directory.
 *
 * <p>The following attribute definition uses Commons Attributes attribute syntax.
 * @@org.springframework.transaction.interceptor.DefaultTransactionAttribute()
 *
 * @author Juergen Hoeller
 * @since 30.11.2003
 */
OrderService라는 인터페이스는 리모트 서비스를 위해 정의했다고 한다.
주석에 나와 있듯이 org.springframework.samples.jpetstore.service.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
 */

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
공지 [작성중/인프런] 스프링부트 시큐리티 & JWT 강의 황제낙엽 2023.12.20 5083
84 @ConfigurationProperties 사용하기 황제낙엽 2025.10.23 1617
83 Spring Boot 에서 서버 로직의 역할별 애노테이션 구분 황제낙엽 2025.10.13 1411
82 (확인전) [2021.03.12] Eclipse에서 Spring Boot로 JSP사용하기(Gradle) file 황제낙엽 2023.12.23 2817
81 Spring Boot PetClinic Sample Application 황제낙엽 2023.12.21 2575
80 Eclipse, Spring Boot, Gradle, SVN 레거시(2019) 시스템 유지보수 환경 구축 file 황제낙엽 2023.11.14 1732
79 [시리즈 강좌] 스프링부트로 웹서비스 구축하기 황제낙엽 2023.07.13 1691
78 Spring Boot에서의 RESTful API 모듈 file 황제낙엽 2020.04.16 1896
77 [POST] Spring MVC 구조 분석 황제낙엽 2024.01.17 2053
76 Spring Framework 에서 사용하는 annotation 황제낙엽 2024.01.17 2093
75 Spring MVC configuration file 황제낙엽 2024.01.17 2041
74 [스프링 시큐리티 OAuth2] 강의 자료와 학습용 소스 file 황제낙엽 2024.01.15 1595
73 OAuth 2.0 Resource Server - Spring Security OAuth2.0 황제낙엽 2023.12.27 2016
72 Spring, JSP, Gradle, Eclipse 환경 구축[2] - 샘플 프로젝트 file 황제낙엽 2023.12.24 1922
71 Spring, JSP, Gradle, Eclipse 환경 구축[1] - 레퍼런스 조사 황제낙엽 2023.12.23 2056
70 spring-security-samples 황제낙엽 2023.12.22 1800
69 [Bard] Spring 과 Spring Boot의 차이 file 황제낙엽 2023.12.21 1803
68 Spring 과 Spring Boot의 차이 file 황제낙엽 2020.05.26 2308
67 Spring Security OAuth2.0 파헤치기 황제낙엽 2019.09.05 2079
66 Spring Security OAuth2구현 file 황제낙엽 2019.09.05 2208
65 Spring Security OAuth 황제낙엽 2019.09.05 2442