1. 이클립스의 마켓플레이스에서 STS(Spring Tool Suite)를 설치합니다.
2. 환경변수 설정
내컴퓨터 선택 -> 마우스 오른쪽 클릭 -> 속성 에 들어가서 다음과 같이 환경변수를 설정합니다.
1) CATALINA_HOME 이라는 환경 변수와 MAVEN_HOME 이라는 환경변수를 새로 만들어줍니다.
2) Path 시스템 변수에
%CATALINA_HOME%\bin;%MAVEN_HOME%\bin;
을 추가해줍니다.
3) cmd 창에
mvn install:install-file -Dfile=D:\JAVA\JRE\lib\ext\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2 -Dpackaging=jar
를 입력하여 success 메시지를 확인합니다.
-Dfile= 옆에는 ojdbc6.jar 파일이 있는 경로를 입력하여야 합니다.
- DgroupId 나 DartifactId 나 Dversion 는 원하는 이름으로 입력하되 꼭 기억하고 있어야 합니다.
3. spring 프로젝트 생성
4. pom.xml 파일을 편집합니다.
--------------------------------------------------------------------------------------------------------------------------
[pom.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 http://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>
<resource-ref>
<description>Oracle-DBCP</description>
<res-ref-name>harim</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
--------------------------------------------------------------------------------------------------------------------------
5. Maven Repository Build
Rebuild 는 시간이 꽤 걸릴수도 있으나 끝까지 기다려주셔야 해요.
6. 프로젝트 속성 수정
여기까지 spring 설치 및 설정은 완료!!!!
7. mybatis 설정
=> Server 프로젝트의 context.xml 파일에 Resource 태그를 추가하고
------------------------------------------------------------------------------------------------------------------------
context.xml
------------------------------------------------------------------------------------------------------------------------
<Resource name="harim"
auth = "Container"
type="javax.sql.DataSource"
username="HARIM"
password="seo"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@192.168.0.92:1521:xe"
maxActive="20"
maxIdle="5"
maxWait="30000"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="false"
/>
--------------------------------------------------------------------------------------------------------------------------
=> 프로젝트의 web.xml 파일을 다음과 같이 편집합니다. (위에 context.xml 파일에서 써 놓은 name 과 type 과, auth 는 똑같게 매칭시켜주어야 하니 주의해주세요. )
--------------------------------------------------------------------------------------------------------------------------
web.xml
--------------------------------------------------------------------------------------------------------------------------
<resource-ref>
<description>Oracle-DBCP</description>
<res-ref-name>harim</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
--------------------------------------------------------------------------------------------------------------------------
'개발메모장' 카테고리의 다른 글
PowerMockup (0) | 2014.12.18 |
---|---|
HTML child 창(login, 회원가입 창) (0) | 2014.12.18 |
javascript 예제 (0) | 2014.12.18 |
login 구현 (모델 2.0 버전) - html, jsp, servlet (0) | 2014.12.18 |
html 예제(simple login, simple calcaulator) (0) | 2014.12.18 |