스프링부트 개발환경 구축_sts

2022. 2. 8. 17:03ksmart_Framework/spring

728x90

 01. 스프링부트 파일 다운로드 

 02. 스프링부트 파일 저장 위치 

내PC-로컬디스크

 03. 용량 수정 

더보기

-Xms1024m
-Xmx2048m

 04. 워크스페이스 만들기 

더보기
파일 만든다.

실행 -> sts-workspace 선택

 05. 언어 설정 

더보기

실행 -> sts-workspace 선택

 06. 프로젝트 만들기 

더보기
Service URL https://start.spring.io
Name springboot
Type Maven
Packaging War
Java Version 8
Language Java
Group ksmart
Artifact Name과 동일
Version 0.0.1-SNAPSHOT
Description Demo project for Spring Boot
Package 그룹명.이름명
ksmart.springboot

 Next > 

Spring Boot DevTools 개발 용이하게 해줌

Thymelea 스트링부트 뷰 엔진

Spring Web 웹 만들라면 선택해야함 

 

 Finish 

   라이브러리 위치 

 7. 서버 포트 설정 

더보기

※ 주의 공백X ※

서버포트넘버

server.port=80

thymeleaf 새로고침 반영 여부

spring.thymeleaf.cache=false

 

 8. 컨트롤러 만들기 

더보기

로컬호스트 썼을 때 반응할 수 있는 GetMapping 만들기

@GetMapping("/")

@GetMapping("/요청되는 주소")

 

실행할 수 있는 메서드 정의

public String main() {
return "main";
}

String -> 포워드 할 대상의 파일 경로

main -> main.html에 메서드를 넣는다.

 

 9. 컨트롤러 사용하기 

더보기
<html xmlns:th="http://www.thymeleaf.org">

코드를 html에 작성해야 thymeleaf 용법을 사용할 수 있다

   빌드 

더보기

크롬 주소창에 localhost 를 입력 후 enter

   파일 위치 

더보기

static : 정적으로 접근하는 페이지

templates : 동적으로 바뀌는 부분(html)

application.properties : 설정에 관련된 부분

•확장자는 ‘html’을 기본으로 설정

인코딩은 ‘utf-8’ 방식으로 설정

Mime 타입은 ‘text/html’로 설정

서버 내부의 cache는 ‘true’로 설정

application.properties 변경

spring.thymeleaf.cache=false

( true: 개발할 때 수정 작업 후 새로고침 시 반영 X)

 

 

   thymeleaf 연결 

 

더보기

window-preferences

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="${encoding}">
<title>Insert title here</title>
</head>
<body>
${cursor}
</body>
</html>
728x90

'ksmart_Framework > spring' 카테고리의 다른 글

springboot 백업_sts  (0) 2022.02.20
@Service @Autowired 어노테이션, ModelAndView_sts  (0) 2022.02.20
thymeleaf 와 Model 객체 사용법_sts  (0) 2022.02.17
기본문법_sts  (0) 2022.02.17
Hello Spring Boot!_sts  (0) 2022.02.17