전체 글(768)
-
[디버그] myBatis resultMap 사용시 주의사항
기본적으로 myBatis의 resultMap에서는 table column과 dto property의 이름이 같다면 굳이 쓰지 않아도 자동으로 매핑을 해준다.하지만 위와 같이 collection을 사용하게 되면 문제가 될 수 있는데 마지막에서 첫번째 줄에서 column으로 id를 썼기 때문에 myBatis가 id라는 column은 매핑이 되었다고 본다. 따라서 위의 두번째 줄과 같이 dto의 id와 column id를 매핑하지 않게 되면 table column에서 가져온 값이 property에 적용이 안된다. 모르면 시간 잡아먹기 좋은 문제이니 알아두면 좋을 듯하다.
2024.05.18 -
[디버그] 스프링 시큐리티 + CORS
되는 코드package com.home.config;import com.home.enums.role.UserRole;import com.home.util.jwt.JwtAuthenticationFilter;import com.home.util.jwt.JwtDtoProvider;import lombok.RequiredArgsConstructor;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.http.HttpMethod;import org.springframework.security.config.Customize..
2024.05.11 -
[Spring] Spring Security Reference
https://howtodoinjava.com/spring-security/inmemory-jdbc-userdetails-service/ Guide to Spring Security UserDetailsService - HowToDoInJavaLearn about the contract that spring security expects from UserDetailsService and PasswordEncoder, initial defaults and basic customizations.howtodoinjava.com
2024.05.06 -
[디버그] 406 에러(Not Acceptable)가 발생할때
내가 컨트롤러에서 반환해줄때 반환해주는 객체가 get method가 있는지 확인해보자. 왜냐하면 jackson은 get method를 이용해서 객체와 json 또는 xml을 매핑시켜주기 때문이다.
2024.05.03 -
[그 외] public key, private key file로부터 가져오기
private PublicKey getPublicKey() { File publicKeyFile = new File("src/main/resources/public.key"); PublicKey publicKey = null; try { byte[] publicKeyBytes = Files.readAllBytes(publicKeyFile.toPath()); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(publicKeyBytes); public..
2024.05.03 -
[알고리즘] 부분합
https://www.acmicpc.net/problem/1806import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()), S = Integer...
2024.05.03