본문 바로가기

Spring9

[Spring] Stateless Spring Security - 1 흔히 찾아볼 수 있는 대부분의 스프링 시큐리티 코드 국내외 가릴 것 없이 수많은 Spring Security(이하 시큐리티) 관련 글을 찾아보았지만, 그 어떤 곳에서도 JWT의 특성을 제대로 살린 시큐리티 코드를 보지 못했다.블로그든, 유튜브든 어디서 시작되었는지 모를 코드를 똑같이 복사 붙여넣기 하고 있는 듯 하다. 이상하다고 생각하는 코드는 아래와 같다.@Servicepublic class UserDetailsServiceImpl implements UserDetailsService { private final UserRepository userRepository; public UserDetailsServiceImpl(UserRepository userRepository) { .. 2024. 10. 5.
[Spring] Gradle 경로 에러 Could not open cp_init remapped class cache for 38ba98x5kyfop9tii2ef1tpdm (C:\Users\USER\.gradle\caches\6.1.1\scripts-remapped\wrapper_init13_cruz05vu9w82js3x0uvl11riu\38ba98x5kyfop9tii2ef1tpdm\cp_init3607aee355f62839c5e6f549478ccc87).> Could not open cp_init generic class cache for initialization script 'C:\Users\USER\AppData\Local\Temp\wrapper_init13.gradle' (C:\Users\USER\.gradle\caches\6.1.1.. 2024. 9. 11.
[Spring] 스프링 부트 3.3에서 추가된 `pageSerializationMode = VIA_DTO` 스프링 공식 Github 해당 스펙 PR 링크(https://github.com/spring-projects/spring-boot/pull/39797)    스프링 3.3으로 자료를 만들다가 처음 보는 WARN 로그가 보였다.2024-08-26T15:13:27.588+09:00 WARN 63105 --- [todo] [nio-8080-exec-2] PageModule$PlainPageSerializationWarning : Serializing PageImpl instances as-is is not supported, meaning that there is no guarantee about the stability of the resulting JSON structure! For a stable JS.. 2024. 8. 26.
[Spring] @ModelAttribute와 @RequestBody의 데이터 바인딩 1. @ModelAttribute를 사용한 경우@Getter@Setter // @Setter가 빠진다면?public class FileUploadDto { private String description; private MultipartFile file;}@Controllerpublic class FileUploadController { @PostMapping public void uploadFile(@ModelAttribute FileUploadDto fileUploadDto) { MultipartFile file = fileUploadDto.getFile(); String description = fileUploadDto.getDescription(); .. 2024. 4. 5.
실시간 알림 서버에서 부하와 비용 최소화하기 1. 알림서버는 Webflux로 구축하고, 오직 데이터 스트림을 내려주는 역할만 한다.2. 부하를 줄이기 위해 소켓 통신이 아닌 HTTP의 기본 스펙인 가벼운 리얼타임 스트리밍이 가능한 SSE를 이용한다.  - 구현이 매우 쉽다는 장점도 있다.3. 단방향 통신이라는 SSE의 단점을 극복하기 위해 데이터 생성, 상태 업데이트에 대한 것은 람다(무료니까!)로 처리한다.  - 클라에서 직접적으로 람다를 트리거 하는게 일단 가능한지 여부는 궁금하긴한데, 현재 프론트는 Next로 구현되고 있기 때문에 그것이 가능하든 말든 문제 없다. Next의 백엔드단에서 쏘면 된다.4. 하나의 call 마다 Lambda를 사용하지 않기 위해 SQS를 buffer로써 이용한다. 즉, 여러 요청들을 모아서 람다를 배치(요청 묶음).. 2024. 1. 10.