전자 정부 프레임워크
[eGov] MVC 파일 구조 변경하고 그에 따른 설정도 변경
토도
2023. 3. 31. 18:04
샘플 웹프로젝트에다가 위치 그대로 MVC 파일을 넣으니 원래 쓰던 구조가 아니여서 불편했다
▼
위치를 바꾼 다섯 개의 파일 다 패키지가 바뀌었기 때문에 빨간 줄이 있다
패키지 이름, Import문 고쳐주기
ctrl + shift + o 는 import문 단축키
생각 나는 대로 변경해야지 일단 type-alias 변경 해주기
/src/main/resources/egovframework/sqlmap/example/sql-mapper-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<typeAliases>
<typeAlias alias="Order" type="egovframework.example.order.model.vo.Order"/>
</typeAliases>
</configuration>
/src/main/resources/egovframework/sqlmap/example/mappers/orderMapper.xml
mapper namespace에 mapper 파일 제목까지 입력 해준다
/src/main/resources/egovframework/spring/context-mapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p">
<!-- SqlSession setup for MyBatis Database Layer -->
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:/egovframework/sqlmap/example/sql-mapper-config.xml" />
<property name="mapperLocations" value="classpath:/egovframework/sqlmap/example/mappers/*.xml" />
</bean>
<!-- MapperConfigurer setup for MyBatis Database Layer with @Mapper("deptMapper") in DeptMapper Interface -->
<bean class="egovframework.rte.psl.dataaccess.mapper.MapperConfigurer">
<!-- <property name="basePackage" value="egovframework.example.sample.service.impl" /> -->
<property name="basePackage" value="egovframework.example.*.model.mapper" />
</bean>
</beans>
끝