전체 글

전체 글

    [Spring boot] swagger 기본 설정

    [Spring boot] swagger 기본 설정

    build.gradle dependencies에 다음 추가 dependencies { ... // swagger ui implementation 'io.springfox:springfox-boot-starter:3.0.0' implementation 'io.springfox:springfox-swagger-ui:3.0.0' } SwaggerConfig.java package com.example.simpleBoard; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBu..

    [대규모서비스] 분산

    웹 어플리케이션 요청은 로드밸런서를 거쳐 AP서버에 도달하고 DB의 I/O작업을 발생시킨다. 서버에 부하가 생길 때 1. AP서버는 CPU부하 위주이고 데이터를 분산하여 저장하지 않기 때문에 단순 서버 추가 증설으로 부하를 분산할 수 있다. 2. DB의 경우 I/O부하 위주이고 데이터를 동기화시켜야한다는 문제가 있어 확장이 쉽지 않다. 또한 단순 증설을 해도 캐싱되지 않는 구간은 똑같이 캐싱되지 않을 확률이 높기 때문에 효율이 좋지 않다. 캐싱은 블럭 단위로 진행된다. DB는 기본적으로 디스크에 데이터를 저장하게 되므로 느린 디스크 I/O작업을 줄이기위해 메모리에 캐싱할 수 있게 환경을 구성하는 것이 중요하다. DB분산을 위한 파티셔닝 데이터 액세스 패턴을 고려하여 분산하는 것을 locality/국소성을..

    [Spring boot] 같은 url, 다른 parameter

    스프링 부트의 컨트롤러에서 같은 url을 사용할 경우, ambiguous mapping found 오류가 발생한다. 이를 해결하기 위해서는 아래와 같이 설정하면 된다. 같은 url 이더라도 parameter가 다르다면 그 사실을 Mapping annotation에 명시해주자. @GetMapping(value = "api/v1/post", params = "title") // 같은 url 다른 param은 Mapping의 params를 이용하면 겹치는 오류가 발생하지 않는다. public List findByTitle(@RequestParam(name = "title") String title) { return postService.findByTitle(title); } @GetMapping("api/v1..

    [JPA/hibernate] Parameter value [\] did not match expected type [~] 오류 해결방법

    [JPA/hibernate] Parameter value [\] did not match expected type [~] 오류 해결방법

    JPA 프로젝트에서 findByItemContaining 등 sql에서의 like 구문 실행 시 같은 method를 두 번 실행하게 되면 오류가 발생하는 상황이 있다. https://github.com/spring-projects/spring-data-jpa/issues/2472 Issue with spring-data "startingWith" and hibernate 5.6.7: Parameter value [\] did not match expected type [java.lang.String (n/ Hello, I am trying to fetch some entity using a “find all by property starting with” query which amount to a Cri..