Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.87 KB | None | 0 0
  1. ★ 1. pom.xml
  2.  
  3. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>ShoppingMall</groupId>
  7. <artifactId>ShoppingMall</artifactId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. <packaging>war</packaging>
  10. <build>
  11. <sourceDirectory>src</sourceDirectory>
  12. <plugins>
  13. <plugin>
  14. <artifactId>maven-war-plugin</artifactId>
  15. <version>2.6</version>
  16. <configuration>
  17. <warSourceDirectory>WebContent</warSourceDirectory>
  18. <failOnMissingWebXml>false</failOnMissingWebXml>
  19. </configuration>
  20. </plugin>
  21. <plugin>
  22. <artifactId>maven-compiler-plugin</artifactId>
  23. <version>3.3</version>
  24. <configuration>
  25. <source>1.8</source>
  26. <target>1.8</target>
  27. </configuration>
  28. </plugin>
  29. </plugins>
  30. </build>
  31. <dependencies>
  32. <dependency>
  33. <groupId>org.springframework</groupId>
  34. <artifactId>spring-webmvc</artifactId>
  35. <version>4.2.6.RELEASE</version>
  36. </dependency>
  37. <dependency>
  38. <groupId>javax.servlet</groupId>
  39. <artifactId>javax.servlet-api</artifactId>
  40. <version>3.1.0</version>
  41. </dependency>
  42. <dependency>
  43. <groupId>org.springframework</groupId>
  44. <artifactId>spring-jdbc</artifactId>
  45. <version>4.2.6.RELEASE</version>
  46. </dependency>
  47. <dependency>
  48. <groupId>org.mybatis</groupId>
  49. <artifactId>mybatis</artifactId>
  50. <version>3.4.0</version>
  51. </dependency>
  52. <dependency>
  53. <groupId>org.mybatis</groupId>
  54. <artifactId>mybatis-spring</artifactId>
  55. <version>1.3.0</version>
  56. </dependency>
  57. <dependency>
  58. <groupId>org.aspectj</groupId>
  59. <artifactId>aspectjweaver</artifactId>
  60. <version>1.8.9</version>
  61. </dependency>
  62. <dependency>
  63. <groupId>com.fasterxml.jackson.core</groupId>
  64. <artifactId>jackson-databind</artifactId>
  65. <version>2.7.4</version>
  66. </dependency>
  67. <!-- http://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
  68. <dependency>
  69. <groupId>commons-fileupload</groupId>
  70. <artifactId>commons-fileupload</artifactId>
  71. <version>1.3.1</version>
  72. </dependency>
  73.  
  74. </dependencies>
  75. </project>
  76.  
  77. ★ 2. web.xml
  78.  
  79. <?xml version="1.0" encoding="UTF-8"?>
  80. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  81. xmlns="http://java.sun.com/xml/ns/javaee"
  82. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  83. id="WebApp_ID" version="3.0">
  84.  
  85. <context-param>
  86. <param-name>contextConfigLocation</param-name>
  87. <param-value>WEB-INF/model.xml</param-value>
  88. </context-param>
  89.  
  90. <listener>
  91. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  92. </listener>
  93.  
  94. <filter>
  95. <filter-name>encoding</filter-name>
  96. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  97. <init-param>
  98. <param-name>encoding</param-name>
  99. <param-value>UTF-8</param-value>
  100. </init-param>
  101. </filter>
  102. <filter-mapping>
  103. <filter-name>encoding</filter-name>
  104. <url-pattern>/*</url-pattern>
  105. </filter-mapping>
  106.  
  107. <servlet>
  108. <servlet-name>dispatcher</servlet-name>
  109. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  110. <init-param>
  111. <param-name>contextConfigLocation</param-name>
  112. <param-value>WEB-INF/front-controller.xml</param-value>
  113. </init-param>
  114. </servlet>
  115. <servlet-mapping>
  116. <servlet-name>dispatcher</servlet-name>
  117. <url-pattern>*.do</url-pattern>
  118. </servlet-mapping>
  119. </web-app>
  120.  
  121.  
  122.  
  123. ★ 3. front-controller.xml
  124.  
  125. <?xml version="1.0" encoding="UTF-8"?>
  126. <beans xmlns="http://www.springframework.org/schema/beans"
  127. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  128. xmlns:aop="http://www.springframework.org/schema/aop"
  129. xmlns:p="http://www.springframework.org/schema/p"
  130. xmlns:tx="http://www.springframework.org/schema/tx"
  131. xmlns:jee="http://www.springframework.org/schema/jee"
  132. xmlns:context="http://www.springframework.org/schema/context"
  133. xmlns:mvc="http://www.springframework.org/schema/mvc"
  134. xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
  135. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
  136. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  137. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
  138. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
  139. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
  140.  
  141. <!-- 자동으로 @Controller만 메모리에 올린다. -->
  142. <context:component-scan base-package="com.shoppingmall.*">
  143. <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
  144. </context:component-scan>
  145.  
  146. <!-- viewResolver 정의!! -->
  147. <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"
  148. p:prefix="/"
  149. p:suffix=".jsp"/>
  150.  
  151. <!-- 파일 업로드 설정 -->
  152. <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
  153.  
  154. <!-- TranSaction 등록!!! -->
  155. <tx:advice id="txtAdvice" transaction-manager="dataSourceTransactionManager">
  156. <tx:attributes>
  157. <!-- 트랜잭션을 적용할 메서드를 등록 -->
  158. <tx:method name="insert" propagation="REQUIRED"/>
  159. <!-- name:적용할 메서드 이름. propagation : 트랜잭션을 무조건 처리할 것인지 여부. -->
  160. </tx:attributes>
  161. </tx:advice>
  162.  
  163. <!-- AOP 설정!! -->
  164. <aop:config>
  165. <!-- 접근지정자:public / 반환형:모든것 / 패키지:패키지에 있는 Service가 들어가는 모든 클래스의 모든 매서드에 적용. / 매개변수 : 모든것 -->
  166. <aop:pointcut expression="execution(public * com.shoppingmall.*.service.*Service*.*(..))" id="serviceCut"/>
  167.  
  168. <!-- aop적용될 코드를 입력. -->
  169. <aop:advisor advice-ref="txtAdvice" pointcut-ref="serviceCut"/>
  170. </aop:config>
  171.  
  172. <!-- 로그인 처리용 HandlerInterceptor 등록!! -->
  173. <mvc:interceptors>
  174. <mvc:interceptor>
  175. <mvc:mapping path="/admin/**"/>
  176. <mvc:exclude-mapping path="/admin/login.*"/>
  177. <bean class="common.intercepter.LoginCheckInterceptor"/>
  178. </mvc:interceptor>
  179. </mvc:interceptors>
  180.  
  181. </beans>
  182.  
  183.  
  184. ★ 4. pom.properties
  185.  
  186. #Generated by Maven Integration for Eclipse
  187. #Mon Oct 14 15:18:52 KST 2019
  188. version=0.0.1-SNAPSHOT
  189. groupId=ShoppingMall
  190. m2e.projectName=ShoppingMall
  191. m2e.projectLocation=C\:\\Users\\hj\\Desktop\\ShoppingMall-master\\ShoppingMall-master\\ShoppingMall
  192. artifactId=ShoppingMall
  193.  
  194.  
  195. ★ 5. model.xml
  196.  
  197. <?xml version="1.0" encoding="UTF-8"?>
  198. <beans xmlns="http://www.springframework.org/schema/beans"
  199. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  200. xmlns:aop="http://www.springframework.org/schema/aop"
  201. xmlns:context="http://www.springframework.org/schema/context"
  202. xmlns:jee="http://www.springframework.org/schema/jee"
  203. xmlns:p="http://www.springframework.org/schema/p"
  204. xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
  205. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  206. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
  207. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd">
  208.  
  209. <!-- @Controller 제외한 모든 어노테이션 객체 메모리에 올린다. -->
  210. <context:component-scan base-package="com.shoppingmall.*">
  211. <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
  212. </context:component-scan>
  213.  
  214. <!-- DataSource 등록 -->
  215. <jee:jndi-lookup jndi-name="jdbc/oracle" id="dataSource" resource-ref="true" />
  216.  
  217. <!-- TransactionManger 등록 -->
  218. <bean id="dataSourceTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
  219. p:dataSource-ref="dataSource"/>
  220.  
  221. <!-- MyBatis 등록 -->
  222. <!-- sqlSessionFactoryBean 등록 -->
  223. <bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean"
  224. p:dataSource-ref="dataSource"
  225. p:configLocation="classpath:mybatis/config.xml"/>
  226.  
  227. <!-- sqlSessionTemplate 등록 -->
  228. <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
  229. <constructor-arg name="sqlSessionFactory" ref="sqlSessionFactoryBean"/>
  230. </bean>
  231.  
  232. </beans>
  233.  
  234. ★ 6. config.xml
  235.  
  236. <?xml version="1.0" encoding="UTF-8" ?>
  237. <!DOCTYPE configuration
  238. PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  239. "http://mybatis.org/dtd/mybatis-3-config.dtd">
  240. <configuration>
  241. <typeAliases>
  242. <typeAlias type="com.shoppingmall.admin.model.Admin" alias="Admin" />
  243. <typeAlias type="com.shoppingmall.product.model.Brand" alias="Brand" />
  244. <typeAlias type="com.shoppingmall.product.model.Nation" alias="Nation" />
  245. <typeAlias type="com.shoppingmall.product.model.PanelSize" alias="PanelSize" />
  246. <typeAlias type="com.shoppingmall.product.model.Product" alias="Product" />
  247. <typeAlias type="com.shoppingmall.product.model.SubCategory" alias="SubCategory" />
  248. <typeAlias type="com.shoppingmall.product.model.TopCategory" alias="TopCategory" />
  249. <typeAlias type="com.shoppingmall.product.model.ProductBrand" alias="ProductBrand" />
  250. <typeAlias type="com.shoppingmall.product.model.ProductNation" alias="ProductNation" />
  251. <typeAlias type="com.shoppingmall.product.model.ProductSize" alias="ProductSize" />
  252. <typeAlias type="com.shoppingmall.product.model.ProductSub" alias="ProductSub" />
  253. <typeAlias type="com.shoppingmall.product.model.EventInfo" alias="EventInfo" />
  254. <typeAlias type="com.shoppingmall.product.model.EventProduct" alias="EventProduct" />
  255. <typeAlias type="com.shoppingmall.member.model.Member" alias="Member" />
  256. <typeAlias type="com.shoppingmall.admin.model.Notice" alias="Notice" />
  257.  
  258. </typeAliases>
  259. <mappers>
  260. <mapper resource="mybatis/AdminMapper.xml" />
  261. <mapper resource="mybatis/BrandMapper.xml" />
  262. <mapper resource="mybatis/NationMapper.xml" />
  263. <mapper resource="mybatis/PanelSizeMapper.xml" />
  264. <mapper resource="mybatis/ProductMapper.xml"/>
  265. <mapper resource="mybatis/SubCategoryMapper.xml" />
  266. <mapper resource="mybatis/TopCategoryMapper.xml" />
  267. <mapper resource="mybatis/ProductBrandMapper.xml" />
  268. <mapper resource="mybatis/ProductNationMapper.xml" />
  269. <mapper resource="mybatis/ProductSizeMapper.xml" />
  270. <mapper resource="mybatis/ProductSubMapper.xml" />
  271. <mapper resource="mybatis/EventInfoMapper.xml" />
  272. <mapper resource="mybatis/EventProductMapper.xml" />
  273. <mapper resource="mybatis/MemberMapper.xml" />
  274. <mapper resource="mybatis/NoticeMapper.xml" />
  275.  
  276. </mappers>
  277. </configuration>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement