728x90 Spring Boot38 Redis 사용 1. dependency 설정 org.springframework.boot spring-boot-starter-data-redis org.springframework.data spring-data-redis 2.6.1 2. redis 설치 및 실행 terminal > docker run -p 6379:6379 --name redis_boot -d redis > docker exec -i -t redis_boot redis-cli 3. StringRedisTemplate 사용 @Component public class RedisRunner implements ApplicationRunner { @Autowired StringRedisTemplate redisTemplate; @Override publ.. 2022. 3. 26. DBCP DBCP -> DataBase Connection Pool Spring boot 기본값 (기본적으로 HikariCP를 사용함) autoCommit -> 자동커밋 / 기본값 : true idleTimeout -> connection이 pool에서 idle 상태로 있을 수 있는 최대 시간 / 기본값 : 600000(10min) ConnectionTimeout -> DBCP Pool에서 일정 기간동안 전달을 못한경우 Exception을 냄 / 기본값 : 30sec maximumPoolSize -> 커넥션 객체를 몇개를 유지할 것이냐 / 기본값 : 10 minimumIdle -> HikariCP가 pool에서 유자하려고 하는 최소 idle연결 수를 제어 / 기본값 : maximumPoolSize와 동일 keep.. 2022. 3. 26. 인메모리 데이터베이스 0. 의존성 추가 org.springframework.boot spring-boot-starter-jdbc org.springframework.boot spring-boot-starter-web com.h2database h2 runtime 1. 인메모리 데이터베이스 기본 연결 정보 확인 @Component public class H2Runner implements ApplicationRunner { @Autowired DataSource dataSource; @Override public void run(ApplicationArguments args) throws Exception { try(Connection connection = dataSource.getConnection()){ System.ou.. 2022. 3. 5. CORS SOP > Single-Origin Policy > 같은 Origin에서만 요청을 보낼 수 있음 CORS > Cross-Origin Resource Sharing > 서로 다른 Origin끼리 Resource를 공유할 수 있음(요청을 보낼 수 있음) > SOP를 우회하기 위한 표준 기술 Origin : 아래 세 요소를 합친 것 URI 스키마(ex. http, https) hostname(ex. localhost) port(ex. 8080) * spring boot에서 아무런 설정없이 CORS를 사용할 수 있는 환경을 제공 예제) Controller @SpringBootApplication @RestController public class SpringcorsserverApplication { @GetMa.. 2022. 2. 28. 이전 1 2 3 4 5 ··· 10 다음 728x90