[SPRING]Spring MVC Project Setup

Date:     Updated:

카테고리:

태그:

[17-1]Spring MVC Project Setup

신규 프로젝트 설정


[기준 IDE 정보 : Spring Tool Suite 3(3.9.18.RELEASE)]

17.1.1. 신규 프로젝트 생성 및 이름 설정

  • 기본 구성 : Spring Legacy Project + MVC
  • 기존 프로젝트와 명칭 및 서버 주소가 겹치지 않도록 주의

17.1.2. 프로젝트 기본 설정 ( java )

17.1.2.1. pom.xml 설정

  • 기본 경로 : [Projectname]/pom.xml

프로젝트에서 사용할 java의 버전 정보 변경

<properties>
    <java-version>11</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>

maven 플러그인이 참조할 자바 버전 설정

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

17.1.2.2. web.xml 설정

  • 기본 경로 : [Projectname]/src/main/webapp/WEB-INF/web.xml

한글 필터 추가

 <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>
    <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping> 

SPRING 카테고리 내 다른 글 보러가기

댓글 남기기