개발 툴
Spring-Boot-DevTools
build만 하면 된다
최소한의 변경 부분만 바로 반영됨
패키징 상태에서 실행할 때 DevTools 의 기능을 무시해주기 때문에
배포시에 패키징에 굳이 뺄 필요가 없다
재기동의 메카니즘 : watcher 가 변경된 것을 감지한다.
Spring Boot 자동 설정
Convention over Configuration
애플리케이션에서 설정한 bean 등록시킴
- @ComponentScan
- @Component, @Service, @Controller, @Repository
- @Configuration
- @Bean
자동설정으로 제공하는 bean 등록
- META-INF/spring.factories (밑에 설명)
- EnableAutoCOnfiguration
- @Configuration && @ConditionalOnXXX
main - resources에 META-INF 디렉토리 생성
그 후, 해당 디렉토리에 spring.factories 파일을 만들어서 자동 빈 정의 등록을 지정할 수 있다
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
패키지이름.Configuration파일이름
@Component
META annotation 처럼 새로운 애노테이션 정의 시에 쓰면 된다
외부 설정 파일
application.properties 또는 application.yaml, 환경변수, java 명령어 arguments 등 키/값의 형태로 되어있는 외부 설정 지원
application.properties 의 경우 가장 구체적이고 가까운 위치의 설정이 우선 순위가 높다
JAR>config 보다
File System 안에 있는 Config 가 더 가까운 위치이다
* properties 한글 깨짐 방지
Editor -> File Encodings -> Transparent native-to-ascii converison 체크
Docker Image build
계층형 이미지 빌드 지원
Docker image는 다른 이미지를 기반으로 새로운 이미지를 만들 수 있다
계층형 이미지를 만든다면 기존 계층은 캐시로 재사용할 수 있으므로 효율적임
application, snapshot-dependecies, springboot-loader, dependencies 4계층
이미지 만들때 계층 확인
spring-boot:build-image
docker dive
관리: Actuator
Spring-Boot-Starter-Actuator
애플리케이션 관련 데이터 및 모니터링 정보 제공
web(JSON), JMX지원
여러 엔드포인트 제공
/beans "빈" 정보 조회
/configprops "프로퍼티" 정보 조회
/logger "logger" 정보 조회 및 변경 가능
/heapdump 메모리의 현재 상태
/threaddump 쓰레드의 현재 상태
/metrics
/mappings 등
강의 듣다보니 actuaor 재미있어보여서 공부 좀 해봐야겠따 ㅎ_ㅎ
management.endpoints.web.exposure.include=*
debug모드로 로그 다 보이게
Spring boot admin
관리자페이지로 접속
spring.boot.admin.client.url=http://localhost:원하는포트
스프링부트의 영역
build - 프로젝트 생성, 의존성 관리, 애플리케이션 패키징 및 실행
코딩 - 개발 툴 제공, 자동 설정, 외부 설정
배포 및 관리 - docker image생성, Actuator, Spring boot admin
java enterprise application 도 공부해봐야징..
'Web > tip' 카테고리의 다른 글
[Java Stream] stream (0) | 2023.04.16 |
---|---|
[Web Security] SQL Injection (0) | 2023.04.15 |
[Spring Boot] 강의 들으면서 쫌쫌따리 (0) | 2023.04.14 |
[Spring Security] WebSecurityConfig (0) | 2023.04.13 |
[JPA] 강의 들으면서 쫌쫌따리 (0) | 2023.04.04 |