본문 바로가기
Java/SPRING

[#Spring] 06. Spring 환경설정

by dopal2 2021. 7. 1.
반응형

1. content 파일 분리

 

스프링에 이용할 설정파일들을 resource에 일괄적으로 저장함


/main/resource에 spring 디렉터리 생성


servlet-context.xml, root-context.xml 를 각각 해당 디렉터리로 이동
servlet-context.xml -> /main/resource/
root-context.xml -> /main/resource/spring/

이후 web.xml에서 context경로, servlet경로 수정

// content 수정
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/*-context.xml</param-value>
</context-param>

// servlet 수정
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>


2. Spring 버전 변경

 pom.xml에서 현재 버전 확인

<java-version>1.6</java-version>
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.6.6</org.slf4j-version>


<groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.15</version>
<groupId>javax.inject</groupId><artifactId>javax.inject</artifactId><version>1</version>
<groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version>
<groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.1</version>
<groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version>
<groupId>junit</groupId><artifactId>junit</artifactId><version>4.7</version>


버전 확인 : https://mvnrepository.com/ 

java-version -> 1.8 
org.springframework-version -> 5.1.4.RELEASE 
org.aspectj-version -> 1.9.6 
org.slf4j-version -> 1.7.25 
log4j -> 1.2.15 
junit - > 4.12 

 

자바 버전 변경

 

우클릭 -> Build Path -> Configure Build Path 
Java Build Path -> Libraries -> JRE System Library
Execution environment : JavaSE-1.8 변경
Project Facets -> Java 1.8 변경

 

 

pom.xml 플러그인 source, target 1.8 변경 

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.5.1</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <compilerArgument>-Xlint:all</compilerArgument>
        <showWarnings>true</showWarnings>
        <showDeprecation>true</showDeprecation>
    </configuration>
</plugin>


3. Maven update


우클릭 -> Maven -> Update Project

반응형

'Java > SPRING' 카테고리의 다른 글

[#SPRING] XX. 중간 정리  (0) 2021.07.02
[#SPRING] 07. 데이터 베이스 연결  (0) 2021.07.02
[#Spring] 05. 인코딩 세팅  (0) 2021.07.01
[#Spring] 04. 프로젝트 생성 및 실행  (0) 2021.07.01
[#Spring] 03. tomcat 세팅  (0) 2021.07.01

댓글