rhanziy

STS 설치과정 본문

Development setting

STS 설치과정

rhanziy 2022. 9. 5. 00:22

<설치, 환경설정 과정>

개발환경 JDK8, 톰캣8버전 설치되어있어야함

 

STS4오류나서 STS3 설치

spring-tool-suite-3.9.9.RELEASE_64.zip

파일 압축 풀고 안에 번들을 STS3으로 바꾼 후 C드라이브에넣기.

sts3 > workspace-spring 폴더 생성(경로)

sts.exe실행

 

환경설정->workspace utf8, 웹 web browser external 크롬, web css,html,jsp 3개 utf-8

+톰캣서버 연결

 

file new > others > spring legacy project 프로젝트 생성

템플릿 아래쪽 Persistence > Spring MVC Project

 

src폴더의 s를 따라가서 sevlet-context.xml, root-context.xml(스프링코어)에 프로젝트관련 세팅할 수 있다.



----------------------------------------------------------------------------------------------------------------

Spring.io >Project > Spring tools4  

Spring Tool Suite(STS) > 4.13 윈도우받음!

 

spring-tool-suite-4.jar로 이름 바꾸고 C드라이브로 > 

폴더 안에 contents 압축 풀고 sts-4.13.0.RELEASE를 C드라이브로 꺼낸다.

sts-4.13.0.RELEASE 안에 폴더 workspace-spring 생성

 

springtoolsuite4.exe실행

경로설정 > c드라이브-sts-4.13.0.RELEASE-workspace-spring 새로만든 폴더로!

 

STS > help > Eclipse Marketplace > STS로 검색

> Spring Tools 3 3.9.14 RELEASE

> Spring Legacy Project 생성! > confirm, finish, restartnow까지

 

환경설정->workspace utf8, 웹 web browser external 크롬 + 톰캣서버연결



스프링 관련 플러그인 설치는 Help 메뉴의 Install New Software... 메뉴를 선택한 후

 [Add...] 버튼을 클릭한다. Add Repository 창에서 Name에 STS를 입력하고 

Location에 http://download.springsource.com/release/TOOLS/update/e4.8/를 

입력한 후 모두 선택! > [Add] 버튼을 클릭한다.

next 하면 remove빼고 3개 다 체크

 

중간에 뭐 뜨면 다 선택하고 install~ 껐다 킨당!

 

file new > others > spring legacy project 프로젝트 생성

템플릿 아래쪽 Persistence > Spring MVC Project

 

----------------------------------------------------------------------------------------------------------------

 

MVC( Model:데이터-vo + View:화면-jsp + Controller:흐름제어 )

 

 view에서 발생한 request를 Controller가 전달, response

Controller = Spring MVC => 핵심 클래스 DispacherServlet

            ↓ ↑  

presentaition(Controller역할) 계층

            ↓ ↑  

비즈니스 로직 계층( dao)

            ↓ ↑  

퍼시스턴스계층(저장소=DB)

 

순차적으로 !

 

>src/main/java

스프링 프로젝트 내부에 클래스 또는 인터페이스를 정의하는 경로이다.

1. 프레젠테이션 계층의 클래스 정의

2. 비즈니스계층의 인터페이스와 구현 클래스 정의           

3. 퍼시스턴스 계층의 ★MyBatis(데이터베이스를 연동하고 쿼리문 수행. 저장소개념) Mapper 인터페이스를 정의

4.VO, DTO클래스 정의

※ 스프링에서는 객체를 '빈'이라고 한다

 

Spring MVC

> sevelt-context.xml

1.프로젝트 내부에 정의한 controller 클래스(@Controller 애너테이션)를 스프링 빈으로 등록한다.

2.등록된 스프링 빈의 속성을 추가한다.

3.root-context.xml에서 등록된 스프링 빈과 연동한다.

 

Spring Core(MyBatis-spring)

MyBatis

> root-context.xml

  1.프로젝트 내부에 정의한 클래스(@componant, @Service애너테이션)를 스프링 빈으로 등록

  2.pom.xml로 외부 주입된 스프링 빈의 속성 추가, 빈의 의존성 처리

 

DATABASE



> views : jsp파일의 작성경로

>web.xml: 톰캣 구동과 관련된 설정파일

>pom.xml: 프로젝트의 라이브러리(클래스의묶음)를 관리하며, 라이브러리 또는 프레임워크를 추가설정한다.

 

스프링 프로젝트가 구동되면 web.xml에서 root-context.xml이 처리된 후 servlet-context.xml이 사용된다.

web.xml >  servlet-context.xml > root-context.xml

--------------------------------------------------------------------------------------------------

 

pom.xml에서

11행 자바버전 1.8 12행버전 org.springframework-version 5.0.7.RELEASE

138행 maven-compiler-plugin

<source>1.8</source>

<target>1.8</target>

-------------------------------------------------------------------------------

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>

      <!-- forceEncoding true 값을 주지 않을 경우 강제 인코딩 하지 않는다. -->

      <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>

 

톰캣서버(was)페이지 한글로 인코딩 = 이클립스의 request.setCharacter.encoding이랑 같은거임

-------------------------------------------------------------------------------------------------------

 

spring mvc작성 후 (controller) run on server하면 url에 /controller가 붙는다.

>톰캣서버 더블클릭 후 module에서 path경로수정 후 저장~!



Comments