본문 바로가기

IT&코딩/자바 프로젝트

자바 프로젝트 19일차 - Maven 2 (mvnBoard)

728x90
반응형

■ com.kgitbank.mvnBoard

 

□ BoardController.java

 

package com.kgitbank.mvnBoard;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.kgitbank.mvnBoard.dto.BoardDTO;
import com.kgitbank.mvnBoard.service.BoardMapper;

@Controller
public class BoardController {
	
	@Autowired
	private BoardMapper boardMapper;
	
	
	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String index() {
		return "index";
	}
	
	
	@RequestMapping("/list_board.do")
	public String listBoard(HttpServletRequest req) {
		
		List<BoardDTO> list = boardMapper.listBoard();
		req.setAttribute("listBoard", list);
		
		return "board/list";
	}
	
	@RequestMapping(value="/write_board.do", method=RequestMethod.GET)
	public String writeFormBoard() {
		return "board/writeForm";
	}
	
	@RequestMapping(value="/write_board.do", method=RequestMethod.POST)
	public String writeProBoard(HttpServletRequest req, 
											@ModelAttribute BoardDTO dto) {
		dto.setIp(req.getRemoteAddr());
		int res = boardMapper.insertBoard(dto);
		
		if (res>0) {
			req.setAttribute("msg", "게시글등록 성공!! 게시글목록페이지로 이동합니다.");
			req.setAttribute("url", "list_board.do");
		}else {
			req.setAttribute("msg", "게시글등록 실패!! 게시글등록페이지로 이동합니다.");
			req.setAttribute("url", "writeForm_board.do");
		}
		return "message";
	}
	
	@RequestMapping("/content_board.do")
	public String contentBoard(HttpServletRequest req, 
											@RequestParam int num) {
		BoardDTO dto = boardMapper.getBoard(num, "content");
		req.setAttribute("getBoard", dto);
		return "board/content";
	}
	
	@RequestMapping(value="/delete_board.do", method=RequestMethod.GET)
	public String deleteFormBoard() {
		return "board/deleteForm";
	}
	
	@RequestMapping(value="/delete_board.do", method=RequestMethod.POST)
	public String delteProBoard(HttpServletRequest req, 
				@RequestParam Map<String, String> params) {
		int res = boardMapper.deleteBoard(params);
		
		if (res>0) {
			req.setAttribute("msg", "글삭제 성공!! 글목록페이지로 이동합니다.");
			req.setAttribute("url", "list_board.do");
		}else if (res<0) {
			req.setAttribute("msg", "비밀번호가 틀렸습니다. 다시 입력해 주세요!!");
			req.setAttribute("url", "deleteForm_board.do?num="+ params.get("num"));
		}else {
			req.setAttribute("msg", "글삭제 실패!! 글보기페이지로 이동합니다.");
			req.setAttribute("url", "content_board.do?num="+ params.get("num"));
		}
		return "message";
	}
	
	@RequestMapping(value="/update_board.do", method=RequestMethod.GET)
	public String updateFormBoard(HttpServletRequest req, 
												@RequestParam int num) {
		BoardDTO dto = boardMapper.getBoard(num, "update");
		req.setAttribute("getBoard", dto);	
		return "board/updateForm";
	}
	
	@RequestMapping(value="/update_board.do", method=RequestMethod.POST)
	public String updateProBoard(HttpServletRequest req, 
											@ModelAttribute BoardDTO dto) {
		int res = boardMapper.updateBoard(dto);
		if (res>0) {
			req.setAttribute("msg", "글수정 성공!! 글목록페이지로 이동합니다.");
			req.setAttribute("url", "list_board.do");
		}else if (res<0) {
			req.setAttribute("msg", "비밀번호가 틀렸습니다. 다시 입력해 주세요!!");
			req.setAttribute("url", "updateForm_board.do?num="+ dto.getNum());
		}else {
			req.setAttribute("msg", "글수정 실패!! 글보기페이지로 이동합니다.");
			req.setAttribute("url", "content_board.do?num="+ dto.getNum());
		}
		return "message";
	}
}

 

■ com.kgitbank.mvnBoard.dto

 

□ BoardDTO.java

 

package com.kgitbank.mvnBoard.dto;

public class BoardDTO {
	
	private int num;
	private String writer;
	private String email;
	private String subject;
	private String passwd;
	private String reg_date;
	private int readcount;
	private String content;
	private String ip;
	
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	public String getWriter() {
		return writer;
	}
	public void setWriter(String writer) {
		this.writer = writer;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public String getPasswd() {
		return passwd;
	}
	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}
	public String getReg_date() {
		return reg_date;
	}
	public void setReg_date(String reg_date) {
		this.reg_date = reg_date;
	}
	public int getReadcount() {
		return readcount;
	}
	public void setReadcount(int readcount) {
		this.readcount = readcount;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
}

 

□ boardMapper.xml

 

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 
  
<mapper namespace="com.kgitbank.mvnBoard.dto.boardMapper"> 
 	<select id="listBoard" resultType="boardDTO">
 		select * from board order by num desc
 	</select>
 	  
 	<select id="getBoard" resultType="boardDTO" parameterType="int">
 		select * from board where num = #{num}
 	</select>
 	
 	<insert id="insertBoard" parameterType="boardDTO">
 		insert into board values(board_seq.nextval, #{writer}, #{email},
 				#{subject}, #{passwd}, sysdate, 0, #{content}, #{ip})
 	</insert>
 	
 	<delete id="deleteBoard" parameterType="int">
 		delete from board where num = #{num}
 	</delete>
 	
 	<update id="updateBoard" parameterType="boardDTO">
 		update board set writer=#{writer}, email=#{email},
				subject=#{subject}, content=#{content} where num = #{num}
 	</update>
 	
 	<update id="plusReadcount" parameterType="int">
 		update board set readcount=readcount+1 where num=#{num}
 	</update>
 	
</mapper>

 

■ com.kgitbank.mvnBoard.service

 

□ BoardMapper.java

 

package com.kgitbank.mvnBoard.service;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kgitbank.mvnBoard.dto.BoardDTO;

@Service
public class BoardMapper {
	
	@Autowired
	private SqlSession sqlSession;
	
	public List<BoardDTO> listBoard(){
		return sqlSession.selectList("listBoard");	
	}
	
	public int insertBoard(BoardDTO dto) {
		return sqlSession.insert("insertBoard", dto);
	}
	
	public BoardDTO getBoard(int num, String mode) {
		if(mode.equals("content")) {
			sqlSession.update("plusReadcount", num);
		}
		
		return sqlSession.selectOne("getBoard", num);
		
	}
	
	public int deleteBoard(java.util.Map<String, String> params) {
		
		BoardDTO dto = getBoard
				(Integer.parseInt(params.get("num")), "password");
		if(dto.getPasswd().equals(params.get("passwd"))) {
			return sqlSession.delete("deleteBoard", Integer.parseInt(params.get("num")));
		}
		return -1;
	}
	
	public int updateBoard(BoardDTO dto) {
		
		BoardDTO bdto = getBoard(dto.getNum(), "password");
		if(dto.getPasswd().equals(bdto.getPasswd())) {
			return sqlSession.update("updateBoard", dto);
		}
		
		return -1;
	}
	
}

 

webapp/WEB-INF/spring

 

□ root-context.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 https://www.springframework.org/schema/beans/spring-beans.xsd">
	
	<!-- Root Context: defines shared resources visible to all other web components -->
	<bean id="dataSource" 
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
		<property name="url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
		<property name="username" value="web01" />
		<property name="password" value="web01" />
	</bean>	
	
	<bean id="sqlSessionFactory"
								class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="typeAliasesPackage" 
								value="com.kgitbank.mvnBoard.dto"/>
		<property name="mapperLocations" 
								value="classpath:com/kgitbank/mvnBoard/dto/*.xml"/>		
	</bean>
	<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg name="sqlSessionFactory" ref="sqlSessionFactory"/>
	</bean>
</beans>

 

 webapp/WEB-INF/spring/appServlet

 

□ servlet-context.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
		http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

	<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
	
	<!-- Enables the Spring MVC @Controller programming model -->
	<annotation-driven />

	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
	<resources mapping="/resources/**" location="/resources/" />

	<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
	<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<beans:property name="prefix" value="/WEB-INF/views/" />
		<beans:property name="suffix" value=".jsp" />
	</beans:bean>
	
	<context:component-scan base-package="com.kgitbank.mvnBoard" />
	
	
	
</beans:beans>

 

■ webapp/WEB-INF/views

 

 

 

□ index.jsp

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- index.jsp -->
<html>
<head>
	<title>게시판</title>
</head>
<body>
	<h1 align="center">스프링으로 연습하는 게시판</h1>
	<ul>
		<li><a href="list_board.do">게시판으로 가기</a>
	</ul>
</body>
</html>

 

□ message.jsp

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- message.jsp -->
<script type="text/javascript">
	alert("${msg}")
	location.href="${url}"
</script>

 

■ webapp/WEB-INF/views/board

 

□ content.jsp

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- content.jsp -->
<html>
<head>
	<title>글내용</title>
</head>
<body>
	<div align="center">
		<b>글내용 보기</b><br><br>
		<table border="1" width="600">
			<tr>
				<th width="20%" bgcolor="yellow">글번호</th>
				<td align="center" width="30%">${getBoard.num}</td>
				<th width="20%" bgcolor="yellow">조회수</th>
				<td align="center" width="30%">${getBoard.readcount}</td>
			</tr>
			<tr>
				<th width="20%" bgcolor="yellow">작성자</th>
				<td align="center" width="30%">${getBoard.writer}</td>
				<th width="20%" bgcolor="yellow">작성일</th>
				<td align="center" width="30%">${getBoard.reg_date}</td>
			</tr>
			<tr>
				<th width="20%" bgcolor="yellow">글제목</th>
				<td colspan="3">${getBoard.subject}</td>
			</tr>
			<tr>
				<th width="20%" bgcolor="yellow">글내용</th>
				<td colspan="3">${getBoard.content}</td>
			</tr>
			<tr bgcolor="yellow">
				<td  colspan="4" align="right">
					<input type="button" value="글수정"
					onclick="window.location='update_board.do?num=${getBoard.num}'">
					<input type="button" value="글삭제" 
					onclick="window.location='delete_board.do?num=${getBoard.num}'">
					<input type="button" value="목록보기" onclick="window.location='list_board.do'">
				</td>
			</tr>
		</table>
	</div>
</body>
</html>

 

□ deleteForm.jsp

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- deleteForm.jsp -->
<html>
<head>
	<title>글삭제</title>
</head>
<body>
	<div align="center">
		<B>글삭제</B><br><br>
		<form name="f" action="delete_board.do" method="post">
			<input type="hidden" name="num" value="${param.num}"/>
			<table border="1" width="300">
				<tr bgcolor="yellow">
					<th>비밀번호를 입력해 주세요.</th>
				</tr>
				<tr>
					<td align="center">비밀번호 : <input type="password" name="passwd"></td>	
				</tr>
				<tr>
					<td align="center">
						<input type="submit" value="글삭제">
						<input type="button" value="목록보기" onclick="window.location='list_board.do'">
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>

 

□ list.jsp

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<!-- list.jsp -->
<html>
<head>
	<title>글목록</title>
</head>
<body>
	<div align="center">
		<b>글 목 록</b>
		<table border="0" width="800">
			<tr bgcolor="yellow">
				<td align="right"><a href="write_board.do">글쓰기</a></td>
			</tr>
		</table>
		<table border="1" width="800">
			<tr bgcolor="green">
				<th>번호</th>
				<th width="30%">제목</th>
				<th>작성자</th>
				<th>작성일</th>
				<th>조회</th>
				<th>IP</th>
			</tr>
		<c:if test="${empty listBoard}">
			<tr>
				<td colspan="6">등록된 게시글이 없습니다.</td>
			</tr>
		</c:if>
		<c:forEach var="dto" items="${listBoard}">
			<tr>
				<td>${dto.num}</td>
				<td><a href="content_board.do?num=${dto.num}">${dto.subject}</a></td>
				<td>${dto.writer}</td>
				<td>${dto.reg_date}</td>
				<td>${dto.readcount}</td>
				<td>${dto.ip}</td>
			</tr>	
		</c:forEach>
		</table>
	</div>
</body>
</html>

 

□ updateForm.jsp

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- updateForm.jsp -->
<html>
<head>
	<title>글수정</title>
	<script type="text/javascript">
		function check(){
			if (f.writer.value==""){
				alert("이름을 입력해 주세요!!")
				f.writer.focus()
				return false
			}
			if (f.subject.value==""){
				alert("제목을 입력해 주세요!!")
				f.subject.focus()
				return false
			}
			if (f.content.value==""){
				alert("내용을 입력해 주세요!!")
				f.content.focus()
				return false
			}
			if (f.passwd.value==""){
				alert("비밀번호를 입력해 주세요!!")
				f.passwd.focus()
				return false
			}
			return true
		}
	</script>
</head>
<body>
	<div align="center">
		<form name="f" action="update_board.do" method="post" onsubmit="return check()">
			<h3>글수정</h3>
			<input type="hidden" name="num" value="${getBoard.num}"/>
			<table border="1" width="500">
				<tr>
					<th width="20%" bgcolor="yellow">이 름</th>
					<td><input type="text" name="writer" value="${getBoard.writer}"></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">제 목</th>
					<td><input type="text" name="subject" size="50" value="${getBoard.subject}"></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">Email</th>
					<td><input type="text" name="email" size="50" value="${getBoard.email}"></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">내 용</th>
					<td><textarea name="content" rows="11" cols="50">${getBoard.content}</textarea></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">비밀번호</th>
					<td><input type="password" name="passwd"></td> 
				</tr>
				<tr bgcolor="yellow">
					<td colspan="2" align="center">
						<input type="submit" value="글수정">
						<input type="reset" value="다시작성">
						<input type="button" value="목록보기" onclick="window.location='list_board.do'">
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>

 

□ writeForm.jsp

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- writeForm.jsp -->
<html>
<head>
	<title>글쓰기</title>
	<script type="text/javascript">
		function check(){
			if (f.writer.value==""){
				alert("이름을 입력해 주세요!!")
				f.writer.focus()
				return false
			}
			if (f.subject.value==""){
				alert("제목을 입력해 주세요!!")
				f.subject.focus()
				return false
			}
			if (f.content.value==""){
				alert("내용을 입력해 주세요!!")
				f.content.focus()
				return false
			}
			if (f.passwd.value==""){
				alert("비밀번호를 입력해 주세요!!")
				f.passwd.focus()
				return false
			}
			return true
		}
	</script>
</head>
<body>
	<div align="center">
		<form name="f" action="write_board.do" method="post" onsubmit="return check()">
			<table border="1" width="500">
				<tr bgcolor="yellow">
					<td colspan="2" align="center">글 쓰 기</td>
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">이 름</th>
					<td><input type="text" name="writer"></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">제 목</th>
					<td><input type="text" name="subject" size="50"></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">Email</th>
					<td><input type="text" name="email" size="50"></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">내 용</th>
					<td><textarea name="content" rows="11" cols="50"></textarea></td> 
				</tr>
				<tr>
					<th width="20%" bgcolor="yellow">비밀번호</th>
					<td><input type="password" name="passwd"></td> 
				</tr>
				<tr bgcolor="yellow">
					<td colspan="2" align="center">
						<input type="submit" value="글쓰기">
						<input type="reset" value="다시작성">
						<input type="button" value="목록보기" onclick="window.location='list_board,do'">
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>

 

■ web.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

	<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/spring/root-context.xml</param-value>
	</context-param>
	
	<!-- Creates the Spring Container shared by all Servlets and Filters -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<!-- Processes application requests -->
	<servlet>
		<servlet-name>appServlet</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
		
	<servlet-mapping>
		<servlet-name>appServlet</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>
	
	<filter>
		<filter-name>encodingFilter</filter-name>
	  	<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
	  	<init-param>
	  		<param-name>encoding</param-name>
	  		<param-value>euc-kr</param-value>
	  	</init-param>
	</filter>
	<filter-mapping>
	  	<filter-name>encodingFilter</filter-name>
	  	<url-pattern>/*</url-pattern>
	</filter-mapping>
	
</web-app>

 

■ pom.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.kgitbank</groupId>
	<artifactId>mvnBoard</artifactId>
	<name>mvnBoard</name>
	<packaging>war</packaging>
	<version>1.0.0-BUILD-SNAPSHOT</version>
	<properties>
		<java-version>1.8</java-version>
		<org.springframework-version>5.2.22.RELEASE</org.springframework-version>
		<org.aspectj-version>1.6.10</org.aspectj-version>
		<org.slf4j-version>1.6.6</org.slf4j-version>
	</properties>
	<dependencies>
		<!-- Spring -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${org.springframework-version}</version>
			<exclusions>
				<!-- Exclude Commons Logging in favor of SLF4j -->
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				 </exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
				
		<!-- AspectJ -->
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>${org.aspectj-version}</version>
		</dependency>	
		
		<!-- Logging -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${org.slf4j-version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.15</version>
			<exclusions>
				<exclusion>
					<groupId>javax.mail</groupId>
					<artifactId>mail</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.jms</groupId>
					<artifactId>jms</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jdmk</groupId>
					<artifactId>jmxtools</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jmx</groupId>
					<artifactId>jmxri</artifactId>
				</exclusion>
			</exclusions>
			<scope>runtime</scope>
		</dependency>

		<!-- @Inject -->
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
		</dependency>
				
		<!-- Servlet -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
	
	<!-- oracle -->
		<dependency>
			<groupId>com.oracle</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>18.0.0</version>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
		<dependency>
    		<groupId>org.mybatis</groupId>
    		<artifactId>mybatis</artifactId>
    		<version>3.2.3</version>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
		<dependency>
    		<groupId>org.mybatis</groupId>
    		<artifactId>mybatis-spring</artifactId>
    		<version>1.2.2</version>
		</dependency>
		
		<!-- Test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.7</version>
			<scope>test</scope>
		</dependency>        
	</dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
728x90
반응형