일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- springboottest
- spring.cloud.openfeign timeout not working
- Medium
- springboot
- mockito테스트
- Java 1.8
- yum install java
- java
- openfeign readTimeout
- JUnit
- easy
- springboottest spybean
- java version
- java 11
- error
- openfeign connectTimeout
- 스프링부트테스트
- log error
- java 1.8 11
- java 여러개 버전
- AWS CLI
- Only void methods can doNothing()
- OpenFeign
- No tests found for given includes
- mockito에러
- aws
- java 버전 변경
- LeetCode
- springboot 3 openfeign readtimeout
- parse
- Today
- Total
목록개발/Spring (18)
쩨이엠 개발 블로그
Mockito로 Unit Test를 하는 도중 Service 내에서 다른 API 호출건이 포함되어있다 테스트할 때에는 포인트 적립이 되지 않도록 Mocking을 하기 위해 doNothing을 사용했다 Mockito.doNothing().when(pointApi).savePoint(any()); 그리고 다음과 같은 에러를 받았다 Only void methods can doNothing()! Example of correct use of doNothing(): doNothing(). doThrow(new RuntimeException()) .when(mock).someVoidMethod(); Above means: someVoidMethod() does nothing the 1st time but throw..
현상 API를 호출하는데 기본 1분이 넘게 걸려 계속 ReadTimeout Exception이 발생한다 Response 주는 서버쪽에서 앞으로도 그럴거라고(!) Timeout 설정을 늘리라고 했다 늘려본다 사용버전 Java v17.0.7 Springboot v3.0.6 OpenFeign v4.0.3 해결 구글링을 해보니 spring boot에서 openfeign 관련 설정을 밑과 같이 설정하면 Timeout이 먹힌다고 했다 application.yml feign: client: config: ${FeignClient의 name 혹은 value}: connectTimeout: 시간 readTimeout: 시간 현재 spring boot 3을 쓰고 있는데, 이 버전에서는 connectTimeout을 찾을 수..
1. 현상 서버에 배포한 뒤 swagger-ui/index.html 을 불렀는데 index.html과 그 밑의 꾸러미들이 주르륵 404가 뜨는 것을 발견 Spring Security도 사용을 안했는데 걸릴 것이 없는데.. 하고 로컬에서 테스트를 해보니 잘 된다 해서 서버 쪽에 이슈가 있다라고 생각했다 외부 게이트웨이다보니 web과 was 서버를 따로 띄워놓고 web 서버에 ssl 및 nginx를 설치하였고 was로 패싱시켜주도록 만들어놨다 was 쪽 로그를 살펴보니 아예 들어오지도 않고 있는 것을 발견 nginx error.log를 살펴보니 이런 에러가 나있었다 2023/06/26 16:16:51 [error] 72043#0: *8 open() "/app/docroot/nginx/swagger-ui/sw..
1. 현상 자동완성을 위해 Redis 적용을 하고 나서 10개 이상이 쌓이면 지우기 위해 ArrayList를 sublist로 잘랐는데 그다음부터 Redis에서 값을 못가져오기 시작했다 List list = (List) redisTemplate.opsForValue().get(PRIFIX_USER + user.id()); list.add(0, keyword); if(list.size() > 10) list = list.subList(0,9); 에러내용 [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.data.redis.serializer.SerializationE..
1. 현상 OpenFeign을 사용하기 위해 dependency들을 추가했다 dependencies { ... implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:2020.0.3" } } 그리고 빌드했더니 빌드 실패가 뜨면서 이런 에러가 보였다 > Could not resolve all files for configuration ':compileClasspath'. > Could not find org.springframework.cloud:spring-..
Mockito를 사용 할 때 분명히 되어야하는데 안될 때가 있다(? 테스트가 안될리가 없는데... 하고 살펴봤더니 UnneccessaryStubbingException이 나타났다 org.mockito.exceptions.misusing.UnnecessaryStubbingException: Unnecessary stubbings detected. Clean & maintainable test code requires zero unnecessary code. Following stubbings are unnecessary (click to navigate to relevant line of code): 1. -> at com.service.DashboardServiceTest.setLineStatus(Das..
Spring Project 중 SecurityConfig에서 ROLE을 줄 때 Admin은 User의 롤을 포함한다라는 정책을 줄 때 쓰는 방법 @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override public void configure(HttpSecurity http) throws Exception{ http.authorizeRequests() .mvcMatchers("/admin").hasRole("ADMIN") .mvcMatchers("/user").hasRole("USER") .expressionHandler(expressionHandler()); // ..
Springboot test 중 Assert를 썼음에도 불구하고 "No tests found for given includes:" 라는 문구가 뜨는 경우가 있다 이 때는 import가 제대로 되어있는지 확인한다 이렇게 되어있는 경우가 많다 jupiter.api 패키지 안에 있는 Test 어노테이션으로 변경하면 해결되는 간단한 이슈! 매번 까먹어서 이번에 다시 적어놓기
Swagger에 Description을 달던 중 ResquestBody안에 LocalDateTime이 있는 경우 @Schema의 example대로 나오지 않는 오류가 발생했다 해결방법 1. JsonFormat 어노테이션 추가 @Schema(name = "CorrelationDto.ChartReq", description = "데이터 리스트") @Data class ChartReq { ... @Schema(description = "기간 시작일", example = "2021-11-30T00:00:00") @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") private LocalDateTime shotRangeStart; @Schema(description = "기간 종료..
SpringbootTest 어노테이션을 사용하다보면 굳이 서버를 올릴 필요 없이 간단하게 Test를 하고 싶을 때가 있다 예를 들면 정말 간단한 테스트코드 작성할 때 정말 Test만을 위한 프로젝트를 만들기로 한다 pom.xml junit junit 4.13 test package를 같이 해놔야 Test를 할 때 어려움이 없다 고 하지만 내 경우는 package도 default로 잡아놓았다 정말 자바코드를 위한 Test import static org.junit.Assert.*; import org.junit.Test; public class ServiceTest { @Test public void example(){ String pattern = "01(0|1)-\\d{3,4}-\\d{4}"; asse..