공식문서 : https://docs.spring.io/spring-framework/reference/integration/rest-clients.html#rest-http-interface-method-parameters HTTP exchange 메서드는 아래와 같은 method signature을 지원한다.@PathVariableAdd a variable for expand a placeholder in the request URL. The argument may be a Map with multiple variables, or an individual value. Type conversion is supported for non-String values.요청 URL에 변수를 추가합니다. 인수는 여러..
Map과 List를 사용하면 스프링 bean에 등록된 구현체(인터페이스를 implements한 클래스들)들을 조회할 수 있다.기본 모양은 이렇다.static class DiscountService { private final Map policyMap; private final List policies; @Autowired public DiscountService(Map policyMap, List policies) { this.policyMap = policyMap; this.policies = policies; System.out.println("policyMap = " + policyMap);..
1. spring boot에서 profile을 끌어가는 방법 : spring coreapplication.yaml에 등록된 profile 정보가 있다. spring은 여기서 local, dev, staging 등의 정보를 끌어간다. (어떻게?까지는 아직 내 레벨에선 이해하기 어려운 듯... ㅠ)// application.yaml 파일---spring: config: activate: on-profile: localspring.profiles.active = local1-1. Profile이란?Profile은 Bean의 그룹을 말한다. Spring은 다양한 profile을 지정할 수 있고, 필요한 bean을 불러와 사용한다.@Profile("profile_name")프로파일에는 논리적 연산자도 사용 ..
인증과 인가API Authentication(인증)이란- API 리소스 접근을 허용하기 전에 사용자의 신원을 확인하는 것 Authentication(인증) : 신원을 확인 (신분증!)Authorization (인가) : 특정 리소스에 접근을 허가 또는 거절 (등급별 게시판 조회!)대표적인 인증 방법 네가지Basic Authentication이름에서 알 수 있듯이 가장 간단한 형태HTTP 인증은 헤더에 저장된다. 이 때 Base64로 인코딩 된다.인증 정보가 평문으로 전달되어 보안이 좋지 않다.매 HTTP 요청에서 인증을 진행한다. (서버로 ID/PWD를 전송)Token Authentication사용자 별 고유한 토큰을 이용한다.매 HTTP 요청의 헤더에 토큰을 저장한다.토큰에 지정된 세션 동안 인증과 인..
Spring WebFlux란?Spring WebFlux는 비동기(Asynchronous) & 논블로킹(Non-blocking) 방식의 웹 프레임워크Spring MVC가 동기(Blocking) 방식이라면, WebFlux는 Reactive Streams 기반으로 동작해서 고성능, 낮은 리소스 사용량이 특징논블로킹(Non-blocking)이란?논블로킹(Non-blocking)이란, 어떤 작업을 요청한 후 결과가 나올 때까지 기다리지 않고 바로 다음 작업을 수행할 수 있는 방식블로킹(Blocking) vs 논블로킹(Non-blocking)블로킹(Blocking) 논블로킹(Non-blocking)작업 방식요청한 작업이 끝날 때까지 기다림기다리지 않고 바로 다음 작업 수행스레드 점유하나의 작업이 끝날 때까지 스레드..
결론부터.mapper.xml 파일을 resources에 넣고 싶지 않은 개발자들은 build.gradle 파일에 sourceSet 셋팅을 추가해주어야한다.그러지 않으면 org.apache.ibatis.binding.BindingException이 날 것이고당신은 애꿎은 namespace만 노려보면서 오타를 찾아 시간을 버릴 것이다.sourceSets { main { resources { // 리소스 파일을 찾는다. srcDirs = ["src/main/java", "src/main/resources"] // 이 경로에서 includes = ["**/*.xml", "**/application.properties"] // 이 유형의 파일을 ..