본문 바로가기

Spring13

[Spring] Mockito Inline Mock 경고 (경고 메시지)더보기Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build what is described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3WARNING: A Java agent has been loaded dynamically (/path/to/byte-buddy-agent.jar)WARNING.. 2025. 2. 22.
[Spring] 스프링 부트 3.4 테스트 관련 신규 사항 (feat. MockMvcTester) 1. @MockitoBean기존에는 @MockBean을 사용해 컨텍스트 내의 빈을 모킹했지만, 스프링 부트 3.4부터는 @MockitoBean을 사용한다.@MockitoBean은 테스트 컨텍스트에서 Mockito를 직접 활용해 모킹된 객체를 빈으로 등록하는 데 특화되어 있다. 어차피 3.4부터는 더 이상 @MockBean을 쓰지 못하게 되었으므로, 강제로 @MockitoBean을 쓸 수 밖에 없다. @SpringJUnitConfig(TestConfig.class)class BeanOverrideTests { @MockitoBean CustomService customService; // tests...}(공식 문서 Java 예시)  2. MockMvcTesterMockMvcTester 내부 구현을 보면 .. 2025. 2. 21.
[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.