일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- java
- el1008e
- easy
- no sources given
- xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
- No tests found for given includes
- java 여러개 버전
- mac os git error
- 스프링부트테스트
- Medium
- maybe not public or not valid?
- property or field 'jobparameters' cannot be found on object of type
- java 버전 변경
- AWS CLI
- java 1.8 11
- log error
- aws
- LeetCode
- springbatch error
- springboottest
- springboot
- Java 1.8
- java version
- parse
- querydsl no sources given
- JUnit
- yum install java
- error
- OpenFeign
- java 11
- Today
- Total
목록개발/Spring (20)
쩨이엠 개발 블로그
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..
Redis 란 Key-Value 형태를 띄고 있는 In Memory 기반의 NoSQL DBMS이다. 보통 캐싱 / 세션관리 등으로 쓰고 있는데 내 경우는 임시데이터를 잠시 저장하고 그걸 빠르게 가져오기 위해 사용하였다. 의존성 환경 Spring boot 2.2.5 RELEASE Spring Boot Data Redis 2.2.5 RELEASE Java 11 (8도 상관없음) plugins { id 'org.springframework.boot' version '2.2.5.RELEASE' id 'io.spring.dependency-management' version '1.0.9.RELEASE' id 'java' } sourceCompatibility = '11' repositories { mavenCen..
기본만 있었던 dependency에 redis를 추가해야할 일이 생겼다 build.gradle 에 추가해준다 dependencies { ... implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive' implementation 'org.springframework.session:spring-session-data-redis' ... } 추가해 준 후 version이 없다는 에러가 났다 그 위에 plugins을 추가해준다 plugins { id 'org.springframework.boot' version '2.3.3.RELEASE' } dependencies { ... implementation 'org.spring..
maven project로 pom.xml을 잘 쓰고 있다가 jib로 build할 때의 가이드가 gradle로 되어있어서.. 예.. 목마른 사람이 우물 파야죠… 바꿉시다… 뭔가 할일이 엄청 많을 줄 알았는데 한 번에 convert 하는 방법이 있었다 multi project인 경우 root pom에서 할 것 $ gradle init --type pom Starting a Gradle Daemon (subsequent builds will be faster) > Task :init Maven to Gradle conversion is an incubating feature. Get more help with your project: https://docs.gradle.org/6.5/userguide/migr..
Class에서 초기화 메소드를 실행하고 싶다 @Service public class DataService { static Map qcPopMap; static Map qcItemMap; static List qcCycleList; DataService(){ initMap(); } private void initMap(){ qcStepConfigMap = new HashMap(); qcTargetDataMap = new HashMap(); qcCycleList = new ArrayList(); } } 예전이라면 생성자를 만들어서 그 안에다 집어넣어서 초기화를 시켜줄 수 있었다 DataService(){ initMap(); } 생성자로 init을 하고싶지 않다면 @PostConstruct를 사용한다 @Ser..
오랜만에 보는 스타트 실패 로그 ㅎㅎㅎㅎ *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the clas..
테스트 시 이 테스트가 어떤건지 설명이 필요할 때 그리고 순서를 정해서 돌리고 싶을 때 사용하는 어노테이션 두개가 있다 @TestMethodOrder @DisplayName @TestMethodOrder 필요한 dependency org.springframework.boot spring-boot-starter-test test DataServiceTests.java @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class) class DataServiceTests { @InjectMocks private DataService service; ..
이번 테스트를 하기 위해서는 initialize 때 필요한 데이터들을 DB에서 가져와야한다 DB 접근은 하기 싫을 때(못할때) 그치만 한 것처럼 데이터 리스트를 세팅하려 할 때 쓸 수 있는 Mockito의 함수에 대해서 정리한다 실제 Service 코드 DataService.java @Service @Slf4j public class DataService { @Autowired private DataMapper dataMapper; static Map targetDataMap; static Map stepConfigMap; static List cycleList; @PostConstruct private void init() { initMap(); initStepItem(); } void initMap(..
보통은 테스트 코드를 짜면서 코드를 짠다지만.. 사실 쉽지않다 ㅋㅋㅋㅋ 이번에도 코드를 짜고 그거 테스트하겠다고 테스트코드를 짜기 시작했는데 생각보다 많은걸 알게되어서 정리하는 용도로 쓴다. 내 경우는 MVC가 필요없는 간단한(?) 코드이므로 @SpringBootTest라는 거대한 아이를 쓰지 않는 방향으로 설계했다. @SpringBootTest는 application을 띄우기때문에 통합테스트에 용이하지만 대신 시간도 오래걸리고 무겁기때문에 단위테스트하는데는 알맞지 않다(서버 올리는데 너무 오래걸려서 짜증났다). 해서 이번에 쓸 Test용 어노테이션은 @RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class) 이 두개가 되겠다 필요한 d..