Gradle로 만들기 스프링부트는 버전 2.7.10
application.yml
server:
port: 5000
servlet:
context-path: /
encoding:
charset: UTF-8
enabled: true
force: true
spring:
mvc:
view:
prefix: /WEB-INF/views/
suffix: .jsp
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/security?serverTimezone=Asia/Seoul
username: tomato
password: abcd1234
#ddl-auto: create이면 매번 테이블을 만들어준다
#create전략이면 테이블을 삭제하고 새로 만들어 준다
#그래서 맨 처음 테이블이 만들어질 때만 생성하고 다음에 실행할 때는 update로 바꾸어 주어야함
#show-sql을 true로 주면 콘솔창에 쿼리문이 출력됨
#hibernate.format_sql: true로 주면 쿼리문이 정렬이 되어서 출력됨
#physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 이것은
#Entity를 만들때(즉 테이블을 만들때) 변수명 그대로 테이블 컬럼으로 만들어준다는 의미임
#open-in-view:true 로 주면 Lazy로드가 가능해짐. false로 하면 영속성 컨텍스트가 service계층에서 종료됨
#영속성을 프리젠테이션 계층까지 가져간다. 트랜잭션은 Service계층에서 종료된다
#Transaction이 종료된 후에도 Controller의 Session이 close 되지 않았기 때문에 영속 객체는
#Persistence 상태를 유지할 수 있으며, 따라서 프록시 객체에 대한 Lazy Loading을 수행할 수 있게 된다
#버전 2.0부터 스프링 부트는 기본적으로 OSIV가 활성화되어 있을때 경고를 발생하므로 프로덕션 시스템에
#영향을 주기 전에 이 문제를 발견할 수 있다
#서블릿 필터에서 Session을 오픈하고 트랜잭션을 시작하던 전통적인 방식의 OPEN SESSION IN VIEW 패턴과 달리
#SpringMVC에서 제공하는 OpenSessionInViewFilter 는 필터 내에서 Session은 오픈하지만
#트랜잭션은 시작하지 않는다. 따라서 서블릿 필터 안에서는 커넥션 풀로부터 JDBC커넥션을 얻을 필요가 없다
#https://getinthere.tistory.com/27 참고하세요
jpa:
open-in-view: true
hibernate:
ddl-auto: update #create로하면 model추가시 테이블 자동생성됨. 매번생성되니 테이블생성되면 update로 바꿀것
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
use-new-id-generator-mappings: false
show-sql: true
properties:
hibernate.format_sql: true
security:
user:
name: user
password: 123
roles: USER
여기서 주석은 # 이다.
src-main-resource에 넣어주기
톰캣 재스퍼 넣어줘야한다. 메이븐으로. 지원을 안해줘서
// https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-jasper
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:10.1.7'
dependency추가해준다.
04/24내용추가
프로젝트 생성시에 디폴트로 지정된 패키지명 아래를 사용합니다. 반드시
약속된 basePakage가 정해져있다.
com.example.demo.controller
com.example.demo.logic
무조건 이런 형식으로 해야된다.
만일 다른 패키지를 사용하려면 추가 설정이 필요한 부분이 있다.
'내생각들 > 개념정리' 카테고리의 다른 글
DevOps 교육 정리 (0) | 2024.03.15 |
---|---|
Red Hat OpenShift (1) | 2024.01.06 |
React 서비스 배포를 위한 build 설정 (0) | 2023.04.11 |
Git Branch 설정하기 (0) | 2023.04.08 |
카카오 로그인 API사용을 위한 설정 (0) | 2023.03.20 |
댓글