작업환경

 eGovFramework Version : 3.8

Eclipse Version : Oxygen.3a Release (4.7.3a)

JDK Version : 1.8


프로젝트를 진행하다 보면 업무를 구분하기 위하여 package를 여러개 만들어야 하는 상황이 발생 합니다.  특히 전자정부프레임워크를 사용하여 개발을 진행할 때에는 기존 egovframework package와 신규로 추가되는 package를 구분하여 작업을 해야 하는 상황이 자주 발생 합니다.  사실 신규 package를 추가하는 방법은 상당히 간단 합니다.

 

egovframework package


설정 xml 수정

base package와 관련된 설정 xml 파일 3개를 수정 합니다. 수정이라기 보다는 신규 package를 등록하는 작업을 진행 합니다. base-package를 등록하면 그 하단의 파일들이 등록이 됩니다.

 

- context-common.xml

/CopyCoding/src/main/resources/egovframework/spring/com/context-common.xml

 <context:component-scan base-package="egovframework, copycoding">

<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>

<context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>

<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>

</context:component-scan>

copycoding 이라는 package를 콤마를 이용하여 추가해주면 적용이 됩니다.


- egov-com-servlet.xml

/ CopyCoding/src/main/webapp/WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml

 <context:component-scan base-package="egovframework, copycoding">

<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>

<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>

<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/>

</context:component-scan>

여기에도 콤마를 이용하여 추가하려는 패키지 최 상단명을 입력합니다.


위에 두개의 xml 파일을 수정하여 설정은 완료 되었고 그 외에 필요한 aspect 또는 filter등의 설정 파일이 있다면 그곳도 추가를 해주면 됩니다방법은 기존에 있는 설정을 복사하여 추가하면 됩니다.

 

context-aspect.xml

/admin/src/main/resources/egovframework/spring/com/context-aspect.xml

 <aop:config>

<aop:pointcut id="egov.serviceMethod" expression="execution(* egovframework.com..impl.*Impl.*(..)) or execution(* copycoding.com..impl.*Impl.*(..))" />

 

<aop:aspect ref="egov.exceptionTransfer">

        <aop:after-throwing throwing="exception" pointcut-ref="egov.serviceMethod" method="transfer" />

</aop:aspect>

</aop:config>


이렇게 or를 사용하여 추가해주면 설정이 끝나고 필요한 파일들을 추가해서 작업을 진행 합니다.


- copy coding -


+ Recent posts