Doc: 문서 파일명 변경
parent
7ce0cb7d9d
commit
bd96ffbed8
@ -1,17 +0,0 @@
|
|||||||
# JavaConfig 변환
|
|
||||||
|
|
||||||
## 1. XML -> Java Code 변환
|
|
||||||
|
|
||||||
### 1) Web.xml 변환
|
|
||||||
|
|
||||||
[Context의 계층 관계](./ContextHierarchy.md)
|
|
||||||
[WebApplicationInitial이란](./WebApplicationInitializer.md)
|
|
||||||
|
|
||||||
[WebApplicationInitial 변환](./WebApplicationInitializer_convert.md)
|
|
||||||
|
|
||||||
### 2) context-*.xml 변환
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 2. Properties 변환
|
|
||||||
|
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
# context-common-convert 설정 변환
|
||||||
|
|
||||||
|
> 공통 설정 관련된 사항들
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
컴포넌트 자동 스캔 설정 변환방법
|
||||||
|
|
||||||
|
<context-common.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<context:component-scan base-package="egovframework">
|
||||||
|
<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>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppCommon.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@ComponentScan(basePackages = "egovframework", includeFilters = {
|
||||||
|
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Service.class),
|
||||||
|
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Repository.class)
|
||||||
|
}, excludeFilters = {
|
||||||
|
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class),
|
||||||
|
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Configuration.class)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
프로퍼티 파일 위치 등록
|
||||||
|
|
||||||
|
<context-common.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
|
||||||
|
<property name="basenames">
|
||||||
|
<list>
|
||||||
|
<value>classpath:/egovframework/message/com/message-common</value>
|
||||||
|
<value>classpath:/egovframework/rte/fdl/idgnr/messages/idgnr</value>
|
||||||
|
<value>classpath:/egovframework/rte/fdl/property/messages/properties</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="cacheSeconds">
|
||||||
|
<value>60</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppCommon.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean
|
||||||
|
public ReloadableResourceBundleMessageSource messageSource() {
|
||||||
|
ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource = new ReloadableResourceBundleMessageSource();
|
||||||
|
String classpath = System.getProperty("java.class.path");
|
||||||
|
reloadableResourceBundleMessageSource.setBasenames(
|
||||||
|
"classpath:/egovframework/message/com/message-common",
|
||||||
|
"classpath:/org/egovframe/rte/fdl/idgnr/messages/idgnr",
|
||||||
|
"classpath:/org/egovframe/rte/fdl/property/messages/properties");
|
||||||
|
reloadableResourceBundleMessageSource.setCacheSeconds(60);
|
||||||
|
return reloadableResourceBundleMessageSource;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Exception 발생시 후처리용 별도작업을 위해 실행환경의 DefaultTrace Handle Manager 를 활용하도록 설정
|
||||||
|
|
||||||
|
|
||||||
|
<context-common.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean id="traceHandlerService" class="egovframework.rte.fdl.cmmn.trace.manager.DefaultTraceHandleManager">
|
||||||
|
<property name="reqExpMatcher">
|
||||||
|
<ref bean="antPathMater" />
|
||||||
|
</property>
|
||||||
|
<property name="patterns">
|
||||||
|
<list>
|
||||||
|
<value>*</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="handlers">
|
||||||
|
<list>
|
||||||
|
<ref bean="defaultTraceHandler" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppCommon.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean
|
||||||
|
public DefaultTraceHandleManager traceHandlerService() {
|
||||||
|
DefaultTraceHandleManager defaultTraceHandleManager = new DefaultTraceHandleManager();
|
||||||
|
defaultTraceHandleManager.setReqExpMatcher(antPathMatcher());
|
||||||
|
defaultTraceHandleManager.setPatterns(new String[] {"*"});
|
||||||
|
defaultTraceHandleManager.setHandlers(new TraceHandler[] {defaultTraceHandler()});
|
||||||
|
return defaultTraceHandleManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
multipart Resolver 설정
|
||||||
|
|
||||||
|
|
||||||
|
<context-common.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean id="spring.RegularCommonsMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||||
|
<property name="maxUploadSize" value="100000000" />
|
||||||
|
<property name="maxInMemorySize" value="100000000" />
|
||||||
|
</bean>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppCommon.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean
|
||||||
|
public CommonsMultipartResolver springRegularCommonsMultipartResolver() {
|
||||||
|
CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
|
||||||
|
commonsMultipartResolver.setMaxUploadSize(100000000);
|
||||||
|
commonsMultipartResolver.setMaxInMemorySize(100000000);
|
||||||
|
return commonsMultipartResolver;
|
||||||
|
}
|
||||||
|
```
|
||||||
@ -0,0 +1,103 @@
|
|||||||
|
# context-datasource.xml 설정 변환
|
||||||
|
|
||||||
|
> 데이터 소스관련 설정 사항들 다루고 있음
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
내장 DB 사용시
|
||||||
|
|
||||||
|
<context-datasource.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<jdbc:embedded-database id="dataSource-hsql" type="HSQL">
|
||||||
|
<jdbc:script location= "classpath:/db/shtdb.sql"/>
|
||||||
|
</jdbc:embedded-database>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppDatasource.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
private DataSource dataSourceHSQL() {
|
||||||
|
return new EmbeddedDatabaseBuilder()
|
||||||
|
.setType(EmbeddedDatabaseType.HSQL)
|
||||||
|
.setScriptEncoding("UTF8")
|
||||||
|
.addScript("classpath:/db/shtdb.sql")
|
||||||
|
// .addScript("classpath:/otherpath/other.sql")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
다른 DB 사용시
|
||||||
|
|
||||||
|
<context-datasource.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- mysql -->
|
||||||
|
<bean id="dataSource-mysql" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
||||||
|
<property name="driverClassName" value="${Globals.DriverClassName}"/>
|
||||||
|
<property name="url" value="${Globals.Url}" />
|
||||||
|
<property name="username" value="${Globals.UserName}"/>
|
||||||
|
<property name="password" value="${Globals.Password}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Oracle -->
|
||||||
|
<bean id="dataSource-oracle" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
||||||
|
<property name="driverClassName" value="${Globals.DriverClassName}"/>
|
||||||
|
<property name="url" value="${Globals.Url}" />
|
||||||
|
<property name="username" value="${Globals.UserName}"/>
|
||||||
|
<property name="password" value="${Globals.Password}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Altibase -->
|
||||||
|
<bean id="dataSource-altibase" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
||||||
|
<property name="driverClassName" value="${Globals.DriverClassName}"/>
|
||||||
|
<property name="url" value="${Globals.Url}" />
|
||||||
|
<property name="username" value="${Globals.UserName}"/>
|
||||||
|
<property name="password" value="${Globals.Password}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Tibero -->
|
||||||
|
<bean id="dataSource-tibero" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
||||||
|
<property name="driverClassName" value="${Globals.DriverClassName}"/>
|
||||||
|
<property name="url" value="${Globals.Url}" />
|
||||||
|
<property name="username" value="${Globals.UserName}"/>
|
||||||
|
<property name="password" value="${Globals.Password}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- cubrid -->
|
||||||
|
<bean id="dataSource-cubrid" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
||||||
|
<property name="driverClassName" value="${Globals.DriverClassName}"/>
|
||||||
|
<property name="url" value="${Globals.Url}" />
|
||||||
|
<property name="username" value="${Globals.UserName}"/>
|
||||||
|
<property name="password" value="${Globals.Password}"/>
|
||||||
|
</bean>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppDatasource.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
void init() {
|
||||||
|
dbType = env.getProperty("Globals.DbType");
|
||||||
|
//Exception 처리 필요
|
||||||
|
className = env.getProperty("Globals." + dbType + ".DriverClassName");
|
||||||
|
url = env.getProperty("Globals." + dbType + ".Url");
|
||||||
|
userName = env.getProperty("Globals." + dbType + ".UserName");
|
||||||
|
password = env.getProperty("Globals." + dbType + ".Password");
|
||||||
|
}
|
||||||
|
|
||||||
|
......
|
||||||
|
|
||||||
|
private DataSource basicDataSource() {
|
||||||
|
BasicDataSource basicDataSource = new BasicDataSource();
|
||||||
|
basicDataSource.setDriverClassName(className);
|
||||||
|
basicDataSource.setUrl(url);
|
||||||
|
basicDataSource.setUsername(userName);
|
||||||
|
basicDataSource.setPassword(password);
|
||||||
|
return basicDataSource;
|
||||||
|
}
|
||||||
|
```
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
# context-idgen.xml 설정 변환
|
||||||
|
|
||||||
|
> Id Generation을 위한 설정이다.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Table별 채번을 위한 Id Generation을 위한 설정으로 한번에 생성될 ID의 blockSize , ID 관리 테이블, ID 사용 테이블, ID의 머릿글자, ID의 자리수, 자리 채움 문자를 설정 할 수 있다.
|
||||||
|
|
||||||
|
<context-idgen.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean name="egovFileIdGnrService"
|
||||||
|
class="egovframework.rte.fdl.idgnr.impl.EgovTableIdGnrServiceImpl"
|
||||||
|
destroy-method="destroy">
|
||||||
|
<property name="dataSource" ref="dataSource-${Globals.DbType}" />
|
||||||
|
<property name="strategy" ref="fileStrategy" />
|
||||||
|
<property name="blockSize" value="10"/>
|
||||||
|
<property name="table" value="IDS"/>
|
||||||
|
<property name="tableName" value="FILE_ID"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean name="fileStrategy"
|
||||||
|
class="egovframework.rte.fdl.idgnr.impl.strategy.EgovIdGnrStrategyImpl">
|
||||||
|
<property name="prefix" value="FILE_" />
|
||||||
|
<property name="cipers" value="15" />
|
||||||
|
<property name="fillChar" value="0" />
|
||||||
|
</bean>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
<EgovConfigAppIdGen.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean(destroyMethod = "destroy")
|
||||||
|
public EgovTableIdGnrServiceImpl egovFileIdGnrService() {
|
||||||
|
EgovTableIdGnrServiceImpl egovTableIdGnrServiceImpl = new EgovTableIdGnrServiceImpl();
|
||||||
|
egovTableIdGnrServiceImpl.setDataSource(dataSource);
|
||||||
|
egovTableIdGnrServiceImpl.setStrategy(fileStrategy());
|
||||||
|
egovTableIdGnrServiceImpl.setBlockSize(10);
|
||||||
|
egovTableIdGnrServiceImpl.setTable("IDS");
|
||||||
|
egovTableIdGnrServiceImpl.setTableName("FILE_ID");
|
||||||
|
return egovTableIdGnrServiceImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EgovIdGnrStrategyImpl fileStrategy() {
|
||||||
|
EgovIdGnrStrategyImpl egovIdGnrStrategyImpl = new EgovIdGnrStrategyImpl();
|
||||||
|
egovIdGnrStrategyImpl.setPrefix("FILE_");
|
||||||
|
egovIdGnrStrategyImpl.setCipers(15);
|
||||||
|
egovIdGnrStrategyImpl.setFillChar('0');
|
||||||
|
return egovIdGnrStrategyImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
위의 형식이 반복되므로 이를 간단하게 builder 형태로 설정 할 수 있다.
|
||||||
|
|
||||||
|
<EgovConfigAppIdGen.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean(destroyMethod = "destroy")
|
||||||
|
public EgovTableIdGnrServiceImpl egovBBSMstrIdGnrService() {
|
||||||
|
return new EgovIdGnrBuilder().setDataSource(dataSource).setEgovIdGnrStrategyImpl(new EgovIdGnrStrategyImpl())
|
||||||
|
.setBlockSize(10)
|
||||||
|
.setTable("IDS")
|
||||||
|
.setTableName("BBS_ID")
|
||||||
|
.setPreFix("BBSMSTR_")
|
||||||
|
.setCipers(12)
|
||||||
|
.setFillChar('0')
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
# context-mapper.xml 설정 변환
|
||||||
|
|
||||||
|
> mapper 설정 파일을 지정해주는 설정파일
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mapper 설정 파일을 등록해 준다.
|
||||||
|
|
||||||
|
<context-mapper.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean id="egov.lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" lazy-init="true" />
|
||||||
|
|
||||||
|
<!-- Mybatis setup for Mybatis Database Layer -->
|
||||||
|
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||||
|
<property name="dataSource" ref="dataSource"/>
|
||||||
|
<property name="configLocation" value="classpath:/egovframework/mapper/config/mapper-config.xml" />
|
||||||
|
|
||||||
|
<property name="mapperLocations">
|
||||||
|
<list>
|
||||||
|
<value>classpath:/egovframework/mapper/let/**/*_${Globals.DbType}.xml</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Mybatis Session Template -->
|
||||||
|
<bean id="egov.sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
|
||||||
|
<constructor-arg ref="egov.sqlSession"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<alias name="sqlSession" alias="egov.sqlSession" />
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppMapper.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean
|
||||||
|
@Lazy
|
||||||
|
public DefaultLobHandler lobHandler() {
|
||||||
|
return new DefaultLobHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = {"sqlSession", "egov.sqlSession"})
|
||||||
|
public SqlSessionFactoryBean sqlSession() {
|
||||||
|
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
|
||||||
|
sqlSessionFactoryBean.setDataSource(dataSource);
|
||||||
|
|
||||||
|
PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver();
|
||||||
|
|
||||||
|
sqlSessionFactoryBean.setConfigLocation(
|
||||||
|
pathMatchingResourcePatternResolver
|
||||||
|
.getResource("classpath:/egovframework/mapper/config/mapper-config.xml"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
sqlSessionFactoryBean.setMapperLocations(
|
||||||
|
pathMatchingResourcePatternResolver
|
||||||
|
.getResources("classpath:/egovframework/mapper/let/**/*_" + dbType + ".xml"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Exception 처리 필요
|
||||||
|
}
|
||||||
|
|
||||||
|
return sqlSessionFactoryBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SqlSessionTemplate egovSqlSessionTemplate(@Qualifier("sqlSession") SqlSessionFactory sqlSession) {
|
||||||
|
SqlSessionTemplate sqlSessionTemplate = new SqlSessionTemplate(sqlSession);
|
||||||
|
return sqlSessionTemplate;
|
||||||
|
}
|
||||||
|
```
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
# context-properties.xml 설정 변환
|
||||||
|
|
||||||
|
> 프로퍼티 정보 설정
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
프로젝트 내에서 사용할 EgovPropertyService에 값을 등록 하는 예제이다.
|
||||||
|
|
||||||
|
<context-properties.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean name="propertiesService" class="egovframework.rte.fdl.property.impl.EgovPropertyServiceImpl" destroy-method="destroy">
|
||||||
|
<property name="properties">
|
||||||
|
<map>
|
||||||
|
<entry key="pageUnit" value="10"/>
|
||||||
|
<entry key="pageSize" value="10"/>
|
||||||
|
<entry key="posblAtchFileSize" value="5242880"/>
|
||||||
|
<entry key="Globals.fileStorePath" value="/user/file/sht/"/>
|
||||||
|
<entry key="Globals.addedOptions" value="false"/>
|
||||||
|
</map>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppProperties.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean(destroyMethod = "destroy")
|
||||||
|
public EgovPropertyServiceImpl propertiesService() {
|
||||||
|
EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl();
|
||||||
|
|
||||||
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
|
properties.put("pageUnit", "10");
|
||||||
|
properties.put("pageSize", "10");
|
||||||
|
properties.put("posblAtchFileSize", "5242880");
|
||||||
|
properties.put("Globals.fileStorePath", "/user/file/sht/");
|
||||||
|
properties.put("Globals.addedOptions", "false");
|
||||||
|
|
||||||
|
egovPropertyServiceImpl.setProperties(properties);
|
||||||
|
return egovPropertyServiceImpl;
|
||||||
|
}
|
||||||
|
```
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
# context-transaction.xml 설정 변환
|
||||||
|
|
||||||
|
> Transanction 관련 설정
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Transanction 설정을 관리하는 곳이다.
|
||||||
|
|
||||||
|
<context-transaction.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||||
|
<property name="dataSource" ref="dataSource"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<tx:advice id="txAdvice" transaction-manager="txManager">
|
||||||
|
<tx:attributes>
|
||||||
|
<tx:method name="*" rollback-for="Exception"/>
|
||||||
|
</tx:attributes>
|
||||||
|
</tx:advice>
|
||||||
|
|
||||||
|
<aop:config>
|
||||||
|
<aop:pointcut id="requiredTx" expression="execution(* egovframework.let..impl.*Impl.*(..)) or execution(* egovframework.com..*Impl.*(..))"/>
|
||||||
|
<aop:advisor advice-ref="txAdvice" pointcut-ref="requiredTx" />
|
||||||
|
</aop:config>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppTransaction.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean
|
||||||
|
public DataSourceTransactionManager txManager() {
|
||||||
|
DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
|
||||||
|
dataSourceTransactionManager.setDataSource(dataSource);
|
||||||
|
return dataSourceTransactionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// TransactionAdvice 설정
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public TransactionInterceptor txAdvice(DataSourceTransactionManager txManager) {
|
||||||
|
TransactionInterceptor txAdvice = new TransactionInterceptor();
|
||||||
|
txAdvice.setTransactionManager(txManager);
|
||||||
|
txAdvice.setTransactionAttributeSource(getNameMatchTransactionAttributeSource());
|
||||||
|
return txAdvice;
|
||||||
|
}
|
||||||
|
|
||||||
|
private NameMatchTransactionAttributeSource getNameMatchTransactionAttributeSource() {
|
||||||
|
NameMatchTransactionAttributeSource txAttributeSource = new NameMatchTransactionAttributeSource();
|
||||||
|
txAttributeSource.setNameMap(getRuleBasedTxAttributeMap());
|
||||||
|
return txAttributeSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashMap<String, TransactionAttribute> getRuleBasedTxAttributeMap() {
|
||||||
|
HashMap<String, TransactionAttribute> txMethods = new HashMap<String, TransactionAttribute>();
|
||||||
|
|
||||||
|
RuleBasedTransactionAttribute txAttribute = new RuleBasedTransactionAttribute();
|
||||||
|
txAttribute.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
||||||
|
txAttribute.setRollbackRules(Collections.singletonList(new RollbackRuleAttribute(Exception.class)));
|
||||||
|
txMethods.put("*", txAttribute);
|
||||||
|
|
||||||
|
return txMethods;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// TransactionAdvisor 설정
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Advisor txAdvisor(DataSourceTransactionManager txManager) {
|
||||||
|
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
|
||||||
|
pointcut.setExpression(
|
||||||
|
"execution(* egovframework.let..impl.*Impl.*(..)) or execution(* egovframework.com..*Impl.*(..))");
|
||||||
|
return new DefaultPointcutAdvisor(pointcut, txAdvice(txManager));
|
||||||
|
}
|
||||||
|
```
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
# context-validator.xml 설정 변환
|
||||||
|
|
||||||
|
> validator 설정 파일을 등록하는 역할을 한다.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
validator 설정 파일들의 위치를 지정해 준다.
|
||||||
|
|
||||||
|
<context-validator.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<bean id="beanValidator" class="org.springmodules.validation.commons.DefaultBeanValidator">
|
||||||
|
<property name="validatorFactory" ref="validatorFactory"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="validatorFactory" class="org.springmodules.validation.commons.DefaultValidatorFactory">
|
||||||
|
<property name="validationConfigLocations">
|
||||||
|
<list>
|
||||||
|
<!-- 경량환경 템플릿 밸리데이터 설정 -->
|
||||||
|
<value>classpath:/egovframework/validator/validator-rules-let.xml</value>
|
||||||
|
<value>classpath:/egovframework/validator/let/**/*.xml</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppValidator.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean
|
||||||
|
public DefaultBeanValidator beanValidator() {
|
||||||
|
DefaultBeanValidator defaultBeanValidator = new DefaultBeanValidator();
|
||||||
|
defaultBeanValidator.setValidatorFactory(validatorFactory());
|
||||||
|
return defaultBeanValidator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DefaultValidatorFactory validatorFactory() {
|
||||||
|
DefaultValidatorFactory defaultValidatorFactory = new DefaultValidatorFactory();
|
||||||
|
defaultValidatorFactory.setValidationConfigLocations(getValidationConfigLocations());
|
||||||
|
return defaultValidatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Resource[] getValidationConfigLocations() {
|
||||||
|
PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver();
|
||||||
|
List<Resource> validationConfigLocations = new ArrayList<Resource>();
|
||||||
|
Resource[] validationRulesConfigLocations = new Resource[] {
|
||||||
|
pathMatchingResourcePatternResolver
|
||||||
|
.getResource("classpath:/egovframework/validator/validator-rules-let.xml")
|
||||||
|
};
|
||||||
|
|
||||||
|
Resource[] validationFormSetLocations = new Resource[] {};
|
||||||
|
try {
|
||||||
|
validationFormSetLocations = pathMatchingResourcePatternResolver
|
||||||
|
.getResources("classpath:/egovframework/validator/let/**/*.xml");
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
validationConfigLocations.addAll(Arrays.asList(validationRulesConfigLocations));
|
||||||
|
validationConfigLocations.addAll(Arrays.asList(validationFormSetLocations));
|
||||||
|
|
||||||
|
return validationConfigLocations.toArray(new Resource[validationConfigLocations.size()]);
|
||||||
|
}
|
||||||
|
```
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
# context-whitelist.xml 설정 변환
|
||||||
|
|
||||||
|
> white list를 관리하는 설정이다.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
white list를 등록하는 설정이다.
|
||||||
|
|
||||||
|
<context-whitelist.xml>
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<util:list id="egovPageLinkWhitelist" value-type="java.lang.String">
|
||||||
|
<value>main/inc/EgovIncHeader</value>
|
||||||
|
<value>main/inc/EgovIncTopnav</value>
|
||||||
|
<value>main/inc/EgovIncLeftmenu</value>
|
||||||
|
<value>main/inc/EgovIncFooter</value>
|
||||||
|
<value>main/sample_menu/Intro</value>
|
||||||
|
<value>main/sample_menu/EgovDownloadDetail</value>
|
||||||
|
<value>main/sample_menu/EgovDownloadModify</value>
|
||||||
|
<value>main/sample_menu/EgovQADetail</value>
|
||||||
|
<value>main/sample_menu/EgovServiceInfo</value>
|
||||||
|
<value>main/sample_menu/EgovAboutSite</value>
|
||||||
|
<value>main/sample_menu/EgovHistory</value>
|
||||||
|
<value>main/sample_menu/EgovOrganization</value>
|
||||||
|
<value>main/sample_menu/EgovLocation</value>
|
||||||
|
<value>main/sample_menu/EgovProductInfo</value>
|
||||||
|
<value>main/sample_menu/EgovProductInfo</value>
|
||||||
|
<value>main/sample_menu/EgovServiceInfo</value>
|
||||||
|
<value>main/sample_menu/EgovDownload</value>
|
||||||
|
<value>main/sample_menu/EgovQA</value>
|
||||||
|
<value>main/sample_menu/EgovService</value>
|
||||||
|
</util:list>
|
||||||
|
```
|
||||||
|
|
||||||
|
<EgovConfigAppWhitelist.class>
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Bean
|
||||||
|
public List<String> egovPageLinkWhitelist() {
|
||||||
|
List<String> whiteList = new ArrayList<String>();
|
||||||
|
whiteList.add("main/inc/EgovIncHeader");
|
||||||
|
whiteList.add("main/inc/EgovIncTopnav");
|
||||||
|
whiteList.add("main/inc/EgovIncLeftmenu");
|
||||||
|
whiteList.add("main/inc/EgovIncFooter");
|
||||||
|
whiteList.add("main/sample_menu/Intro");
|
||||||
|
whiteList.add("main/sample_menu/EgovDownloadDetail");
|
||||||
|
whiteList.add("main/sample_menu/EgovDownloadModify");
|
||||||
|
whiteList.add("main/sample_menu/EgovQADetail");
|
||||||
|
whiteList.add("main/sample_menu/EgovAboutSite");
|
||||||
|
whiteList.add("main/sample_menu/EgovHistory");
|
||||||
|
whiteList.add("main/sample_menu/EgovOrganization");
|
||||||
|
whiteList.add("main/sample_menu/EgovLocation");
|
||||||
|
whiteList.add("main/sample_menu/EgovProductInfo");
|
||||||
|
whiteList.add("main/sample_menu/EgovServiceInfo");
|
||||||
|
whiteList.add("main/sample_menu/EgovDownload");
|
||||||
|
whiteList.add("main/sample_menu/EgovQA");
|
||||||
|
whiteList.add("main/sample_menu/EgovService");
|
||||||
|
return whiteList;
|
||||||
|
}
|
||||||
|
```
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
# JavaConfig 변환
|
||||||
|
|
||||||
|
## 1. web.xml 변환
|
||||||
|
기존의 web.xml에서 설정을 변환하여 EgovWebApplicationInitializer 에서 설정
|
||||||
|
|
||||||
|
```
|
||||||
|
src/main/java/egovframework/com/config/EgovWebApplicationInitializer.java
|
||||||
|
```
|
||||||
|
|
||||||
|
- [WebApplicationInitial 변환 방법](./WebApplicationInitializer-convert.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 2. context-*.xml 변환
|
||||||
|
|
||||||
|
`src/main/java/egovframework/com/config/` 아래에 설정 파일 위치
|
||||||
|
|
||||||
|
기존 ApplicationContext 레벨의 설정들은 `EgovConfigApp*.java` 로 구성.
|
||||||
|
기존 WebApplicationContext 레벨의 설정들은 `EgovConfigWeb*.java` 로 구성
|
||||||
|
|
||||||
|
|
||||||
|
- [설정파일 변환 방법](./configuration-setting-bean-regist.md)
|
||||||
|
- [context-aspect 변환](./context-aspect-convert.md)
|
||||||
|
- [context-common 변환](./context-common-convert.md)
|
||||||
|
- [context-datasource 변환](./context-datasource-convert.md)
|
||||||
|
- [context-idgen 변환](./context-idgen-convert.md)
|
||||||
|
- [context-mapper 변환](./context-mapper-convert.md)
|
||||||
|
- [context-properties 변환](./context-properties-convert.md)
|
||||||
|
- [context-transaction 변환](./context-transaction-convert.md)
|
||||||
|
- [context-validator 변환](./context-validator-convert.md)
|
||||||
|
- [context-whitelist 변환](./context-whitelist-convert.md)
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
참고 사항
|
||||||
|
|
||||||
|
[Context의 계층 관계](./context-hierarchy.md)
|
||||||
|
|
||||||
|
[WebApplicationInitial이란](./WebApplicationInitializer.md)
|
||||||
Loading…
Reference in New Issue