SpringBoot 입문 ... 좋으니까 동확이다!
6243 단어 SpringBoot초보자입문
이 페이지 정보
태어나 처음으로 SpringBoot를 사용하겠습니다!
리굴은 움직이고 나서 공부할게!
그런 컨셉을 위한, 동작 확인에 좁힌 페이지입니다.
원래 SpringBoot는 무엇입니까?
Java의 프레임 워크 중 하나.
기존의 Spring이기도 했던 설정 파일의 혼돈을 해소하고 있어 인기를 모으고 있다.
참고 : htps : // 엔 g 엔 t 란세. 코 m / 그럼 め - sp 링g 보오 t
개발 정책 및 준비
HelloWorld적인 웹 프로젝트를 만들어 봅시다.
DB와도 연결만 해보자.
환경
서비스/버전
실행 환경
Windows10
개발 환경
eclipse Oxygen.2 Release (4.7.2) Java 버전
개발 언어
자바 8
프레임워크
SpringBoot 2.1.3
DB
PostgreSQL 10
설치 정보
각종 설치는 선인의 지혜를 참조하십시오.
SpringBoot 플러그인은 eclipse의 마켓플레이스에서 가져옵니다.
Postgres도 초기 설정 그대로 포치 포치 설치로 OK.
프로젝트 만들기
1. 이클립스 → 파일 → 신규 → 기타로 새로운 PJ 마법사로 이동
2. SpringBoot → Spring 스타터 프로젝트 선택
3. 이름과 패키징을 적절하게 설정하고 다음
※빌드 툴은 Gradle을 선택(나중에 작성 예정의 페이지도 Gradle 전제가 됩니다)

4. 종속성(사용하려는 플러그인) 정의
※나중에 추가할 수 있습니다
추가
개요
DevTools
프로그램을 업데이트 할 때 자동으로 다시 시작하는 개발자 친화적 인 사람
PostgreSQL
Postgres 연결용 패키지
Thymeleaf
서버의 값을 Html (보기)에 좋은 느낌으로 전달하는 좋은 사람
웹
웹 애플리케이션을 원한다면 넣어

이런 식으로 프로젝트가 생성된다고 생각합니다.
주요한 것
개요
src/main/java
여기에 컨트롤러 배치
src/main/resources
templates에 뷰(html) 배치
application.properties
DB 연결 정보 설정

뷰 및 컨트롤러 배치
src/main/java 아래 패키지 내에서 생성
SampleController.java
package ※パッケージ名※
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class SampleController {
@RequestMapping("/index")
public String index() {
return "index";
}
}
src/main/resources/templates 내에 생성
index.html
Hello World!!
DB와 연결
1. PostgreSQL 측에 적절한 스키마를 세우기
적절한 방법으로 수행한다.
예: pgAdmin 시작, 왼쪽 메뉴에서 Create

프로젝트 측에 설정 작성
본 기사에서는 접속만. DAO 제작은 다른 기회에.
application.properties
<!-- Postgres property -->
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/※スキーマ名※
spring.datasource.username=※設定したPostgresユーザ名※
spring.datasource.password=※設定したPostgresパスワード※
실행해보기

안전하게 HelloWorld가 표시되었습니다.

부록: 참고 기사
쌍두인 주석과 빌드 도구에서 읽어보세요!
이하의 기사등이 참고가 되었습니다.
Reference
이 문제에 관하여(SpringBoot 입문 ... 좋으니까 동확이다!), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ketman55/items/16d1e491a5a493f71c92텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)