전체 글
-
[AWS] ECR이란?AWS 2023. 10. 10. 00:01
AWS ECR이란? Amazon Web Service Elastic Container Registry의 약자로 AWS에서 제공하는 Docker 이미지 등의 컨테이너 이미지를 등록할 수 있도록 제공하는 서비스입니다. Docker Hub에서 제공하는 이미지 등록기능을 AWS 에서 제공합니다. IAM을 통하여 이미지에 대한 액세스를 제어하고, S3에 저장하기 때문에 고가용성이 유지됩니다. 코드를 작성하고 Docker Image로 만들기 -> Amazon ECR에 저장 -> 이미지를 가져와 ECS, EKS, On-Premise 등에서 어느 곳이던 실행 AWS ECR의 구성요소 Registry - 각 계정마다 제공되며 하나 이상의 Repository를 생성할 수 있습니다. Repository - Docker 이미..
-
Spring Batch 프로젝트 생성하기 - Spring Boot 3.1프로젝트/스프링 배치 튜토리얼 2023. 10. 9. 00:01
개요 Spring Boot가 3.0이 출시되면서 Batch도 조금 바뀌게 되어 프로젝트를 생성 및 간단한 실행을 수행해보고자 합니다. Gradle Dependencies dependencies { implementation("org.springframework.boot:spring-boot-starter-batch") runtimeOnly("org.postgresql:postgresql:42.3.5") testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.springframework.batch:spring-batch-test") implementation(project(":core")) ..
-
[JPA] Page vs SliceJPA 2023. 10. 8. 00:01
개요 페이징을 처리하면서 Page, Slice, Window의 차이에 대해 명확하게 이해하고 넘어가고자 합니다. TestEntityRepository 준비 interface TestEntityRepository: JpaRepository { fun findPageBy(pageable: Pageable): Page fun findSliceBy(pageable: Pageable): Slice } Page Page는 일반적인 게시판 형태의 페이징에서 많이 활용됩니다. 예시 코드 @DataJpaTest class TestEntityTest @Autowired constructor( private val testEntityRepository: TestEntityRepository, ){ @PostConstruct..
-
Spring Security 필터 아키텍처 이해하기 - Spring Security Hands On 1Spring Framework/Spring Security 2023. 10. 7. 00:01
개요 Spring Security를 사용하며 SecurityConfig 설정을 수행하다 왜 인증이 필요한 Path에만 필터가 제공되지 않는 것일까? 라는 의문을 시작으로 아키텍처부터 파악해서 Spring Security와 친해지려고 합니다. 버전은 Spring Boot 3.1 기준입니다. @Configuration @EnableWebSecurity @EnableMethodSecurity open class SecurityConfig { @Bean fun filterChain(httpSecurity: HttpSecurity): SecurityFilterChain { httpSecurity .csrf { it.disable() } .authorizeHttpRequests { it .requestMatcher..
-
Spring Filter Security로 인가처리 - Spring Filter Hands On 3Spring Framework/Filter 2023. 10. 6. 00:01
개요 Spring Security Hands On 시리즈에 들어가야 할 내용 같다고 생각하지만.. Spring Security를 활용하면 조금 더 편리하게 인가처리가 가능하기 때문에 소개하고자 합니다. Spring Security 의존성 추가 implementation("org.springframework.boot:spring-boot-starter-security") 테스트용 Controller 구현 @RestController class AuthorizationTestController { @GetMapping("/admin/admin-path") fun onlyAdmin(@RequestHeader role: String): String{ return "접근 가능" } @GetMapping("/use..
-
Spring Filter Header 인가 처리 - Spring Filter Hands On 2Spring Framework/Filter 2023. 10. 5. 00:01
개요 Spring Filter의 정의에 이어 실습으로 컨트롤러를 구성하고 헤더를 받아 컨트롤러 별 인가를 처리해보려고 합니다. 해당 방법 이외에 Spring Security를 활용할 수도 있습니다. Filter에서 범위가 조금 벗어난다고 생각이 들지만 다음 챕터에서 한번 다루어 보려고 합니다. Controller 세팅 @RestController class AuthorizationTestController { @GetMapping("/admin-path") fun onlyAdmin(@RequestHeader role: String): String{ return "접근 가능" } @GetMapping("/user-path") fun onlyUser(@RequestHeader role: String): St..
-
Spring Filter란? - Spring Filter Hands On 1Spring Framework/Filter 2023. 10. 4. 00:01
개요 Spring은 중복된 코드를 제공하기 위해 공통적인 작업을 수행하는 많은 기능들을 제공합니다. 필터, 인터셉터, AOP 등이 제공되는데 여기서 Filter에 대해서 알아보고자 합니다. Filter의 개념을 알아보고 실습을 통해 Hands On 시리즈를 작성해보고자 합니다. Spring Filter란? Spring Filter를 사용하면 Client의 요청이 Controller에 도달하기 전에 특정작업을 수행하거나, Controller가 Client로 다시 보내는 응답에 대해 부가작업을 수행할 수 있도록 지원합니다. 엄밀히 말하면 Dispatcher Servlet에 도달하기 전후로 부가작업을 수행합니다. Request 값, Response 값 로깅 request Body와 header의 포맷팅 Aut..
-
QueryDSL 페이징에 QuerydslPredicateExecutor 활용하기JPA 2023. 10. 3. 00:01
QuerydslPredicateExecutor란? Predicate 인스턴스를 실행할 수 있도록 spring data에서 지원하는 인터페이스입니다. 반환값들을 보면 Page로 Predicate를 통해 페이징 된 결과를 받을 수 있습니다. 인터페이스의 네이밍을 보았을 때 Predicate를 기반으로 실행한다!라고 이해할 수 있습니다. Predicate란? Predicate를 직역하면 서술어라는 의미를 가집니다. 간단하게는 where 절에 들어가는 조건문을 뜻합니다. BooleanBuilder, BooleanExpression이 Predicate 인터페이스를 구현하고 있습니다. 사용법 QuerydslPredicateExecutor 인터페이스 상속받기 @Repository interface DeliveryJp..