본문 바로가기

IT/Spring6

Spring Profile 설정법 2022. 1. 7.
DB Replication에 따른 Spring 설정 1. DB Replication - 데이터베이스 이중화 방식 중 하나로 하나의 Master DB와 여러대의 Slave DB로 구성. Master DB에 데이터의 변경이 감지되면 Master DB의 로그를 기반으로 Slave DB에 복제 합니다. - 서비스 사용자의 증가로 트래픽이 늘어날 경우 DB에 부하가 생겨 속도 저하, time out 에러가 발생할 수 있습니다. - Replication을 통해 select요청은 Slave DB(읽기전용)에서 처리, CUD는 Master DB에서 처리할 수 있도록 분리하여 트래픽을 분산되도록 합니다. Spring의 @Transactional 설정에 따라 설정하는 DB가 달라지게 됩니다. @Transactional(readOnly = true) 인 경우는 Slave D.. 2021. 12. 10.
Springboot에서 h2 Database 설정 Springboot를 사용하면서 간단하게 인메모리 데이터베이스 구성하여 확인하기 위해 사용합니다. 1. dependency 추가 (maven) - DB연결을 하기 위한 jdbc 인터페이스 추가 - h2 dependency를 추가 (사용하는 DB에 따라 맞는 dependency를 추가합니다.) org.springframework.boot spring-boot-starter-jdbc com.h2database h2 runtime 2. Configuration application.yml (Springboot 프로젝트에 포함된 application.properties 또는 application.yml에 설정) spring: h2: console: enabled: true path: /h2-console dat.. 2021. 12. 10.
Spring Security 기본 API, filter 1. 스프링 시큐리티 시작 (dependency 추가) maven - pom.xml org.springframework.boot spring-boot-starter-security gradle - build.gradle implementation 'org.springframework.boot:spring-boot-starter-security'2. SecurityConfig 설정 클래스를 만들어 보안 및 인가 필터 설정 import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org... 2021. 7. 8.
반응형