메뉴 건너뛰기

조회 수 4160 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

Spring Boot 프로젝트 생성


Spring Starter Project 실행




File > New > Spring Starter Project (선택)


 

 

 

 




Spring Boot 사용을 위해 Packaging 은 Jar 선택


Next > New Spring Starter Project



Dependencies 선택

Core : DevTools

SQL : MySQL

Template Engines : Velocity

Web : Web


* 선택한 요소들은 pom.xml 파일에 반영 됩니다.

* Frequently Used : 과거 프로젝트 생성시 선택했던 항목 표기 (처음 설치시 나오지 않음) 



Dependencies Template Engines (템플릿 엔진)


Freemarker:  spring-boot-starter-freemarker 
Velocity:  spring-boot-starter-velocity 
Groovy Templates:  spring-boot-starter-groovy-templates 
Thymeleaf:  spring-boot-starter-thymeleaf 
Mustache:  spring-boot-starter-mustache 

어떤걸 사용할지 고민중~~ 좀더 찾아보고~~



Next > Site Info

 

 

 

 

 



 프로젝트 구성 중, 뭘 그리 받아야 하는지~~ 

 

 

 

 

 

 

생성된 프로젝트 패키지 구조


Hello World 실행 페이지 개발


1. index.html 을 통한 Hello World 웹 페이지 실행

 

index.html 추가

Package Explorer > src/main/resources > static 폴더에 "index.html" 생성


 

 

 

 

  

Hello World Sample Code

   <!DOCTYPE html>
  <html lang="ko">
  <head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv="Content-Language" content="ko">
  <title>Spring Boot Hello World</title>
  </head>
  <body>

  <h1>Spring Boot Hello World</h1>

  </body>
  </html> 

 

 

 

 

  

​index.html 실행



Spring Boot App 실행



Console > Spring Boot 실행 확인


 

 

 


기본 포트인 8080 으로 Spring Boot App 실행 확인 

( netstat -an | find "8080" )



 

 

 

 

 웹 브라우저에서 index.html 실행 확인

 

 http://localhost:8080 브라우저에서 실행 성공

만약 권한 오류등이 나온다면, Dependencies 에서 Hello World 용으로만 설치 권장 ^^

기본 포트 8080 이 이미 사용중 이라면 catalina.properties 나 application.properties 설정 변경



2. Controller 를 통한 Hello World 출력 


 

 

 

 

 

WEB 코드 저장 Package 생성, "Paccom.example.web"

 


Class 작업용 "HelloWorld.java" 생성, 이크 네이밍룰 미적용 ㅠㅠ"

 


HelloWorld Sample Code

package com.example.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloWorld {

 @RequestMapping("/helloworld")
 public @ResponseBody String helloworld() {
  return "Spring Boot Hello World";
 }
}
 


HelloWorld Controller 코드 등록 후 Spring Boot 재 시작


 


실행 결과



List of Articles
번호 제목 날짜 조회 수
31 전자정부프레임워크 v2.5, v2.6 오라클 세팅하기 file 2016.09.12 5109
» Spring Boot 프로젝트 생성 file 2016.09.02 4160
29 전자정부표준프레임워크 - 설치 file 2016.09.02 6277
28 MySQL에 All-in-one 설치시 webmaster로 로그인 안되는 문제 해결을 위한 2가지 수정사항 file 2016.08.29 4951
27 war로 묶지 않아도 컴파일된 소스 위치 확인하기 file 2016.08.29 4116
26 간단한 개인홈페이지 만들어보기 file 2016.08.29 4748
25 전자정부 표준프레임워크 설치하기 file 2016.08.29 4250
24 Database Connections 생성하기 (Mysql) file 2016.08.29 3365
23 Database Connections 생성하기 (오라클) file 2016.08.29 4072
22 Select statements cannot be executed as an update. 에러 해결방법 file 2016.08.29 3830
21 회원가입 폼(form)으로 보는 Validator 구현하는 방법 file 2016.08.29 7108
20 스프링(Spring)의 Validator 기능을 사용하다가 '정의되지 않음 또는 null 참조인 'type' 속성을 가져올 수 없습니다.'라는 오류를 만났을 때 해결방법 file 2016.08.29 5159
19 배치관리 컴포넌트 생성 후 에러 날 때 해결방법 file 2016.08.29 4265
18 새로 만든 모듈의 iBatis 쿼리를 새로운 xml 파일에 만들고 싶다면 이렇게 하자. file 2016.08.29 3773
17 새로 만든 모듈의 iBatis 쿼리를 새로운 xml 파일에 만들고 싶다면 이렇게 하자. file 2016.08.29 3649
16 No bean name '***Service' is defined 오류나는 이유 및 해결방법 file 2016.08.29 4561
15 회원가입 양식에서 (필수/옵션)필드 추가/제거하기 file 2016.08.29 4471
14 회원가입 양식에서 (필수/옵션)필드 추가/제거하기 file 2016.08.29 5325
13 기존 프로젝트, Table, View 모두 다 삭제하기 file 2016.08.29 4600
12 로그인 컴포넌트 설치시 뷰 생성 에러 해결방법 (ORA-01031: 권한이 불충분합니다) file 2016.08.29 3872
Board Pagination Prev 1 2 3 4 5 6 7 8 Next
/ 8

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved