필요 Dependency 선택 후 Generate
Spring Web, Spring Security, Spring Data JPA, MySQL driver, Lombok, Spring Boot Dev Tools, Thymeleaf
application.yml 파일
server:
port: 8000 #포트
servlet:
context-path: /blog #시작 path
encoding:
charset: UTF-8
enabled: true
force: true
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/blog?serverTimezone=Asia/Seoul
username: DB 아이디
password: DB 비밀번호
jpa:
open-in-view: true # 영속성 컨텍스트를 프레젠테이션 계층 (Controller 전) 까지 가져감. -> Lazy Loading을 가능하게 해줌
hibernate:
ddl-auto: create # 프로젝트 실행 시 테이블 새로 생성
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl # Entity table을 만들 때, column명을 변수명 그대로 (Camel case)
# org.hibernate.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy # snake_case로 변경
show-sql: true # console에 sql문 표시
properties:
hibernate.format_sql: true # console에 sql문 예쁘게 표시
id:
new_generator_mappings: false # JPA 기본 넘버링 전략
jackson:
serialization:
fail-on-empty-beans: false
Git 설정
git init
git add .
git commit -m "환경설정 완료"
git remote add origin 주소
git push origin master
Spring Boot Dev Tools 자동 빌드 세팅
https://barbera.tistory.com/47
'Web > Spring, SpringBoot' 카테고리의 다른 글
Spring @ModelAttribute 매핑 오류 해결 방법 (Setter, Enum 변환) (0) | 2025.03.20 |
---|---|
Spring Data JPA에서 커스텀 Repository 구현체 인식 및 작동 방식 (0) | 2025.03.20 |
스프링 부트 테스트 시 JPA Auditing 에러 (0) | 2025.03.12 |
Mockito를 이용한 테스트 vs. SpringBootTest의 차이점 (0) | 2025.03.05 |
application.properties 민감한 정보 보호하는 방법 (0) | 2025.02.13 |