목록2018/08/24 (3)
코딩하는 오징어
QueryDsl이란?JPQL의 빌더(Criteria)클래스QueryDsl 사용전 설정dependency 추가dependencies { compile("com.querydsl:querydsl-core:4.2.1") compile("com.querydsl:querydsl-apt:4.2.1") compile("com.querydsl:querydsl-jpa:4.2.1") compile("com.querydsl:querydsl-collections:4.2.1") ... } Q클래스를 먼저 생성 후 컴파일 되어야 하므로 task를 먼저 실행시켜야함def queryDslOutput = file("src-gen/main/java") sourceSets { main { java { srcDir "src-gen/main/..
Junit 4 & Spring Test을 이용한 TDD 환경 세팅(다음은 Spring boot를 이용하지 않은 애플리케이션에서의 테스트 환경이다.)SpringTestSupport 클래스에 설정 후 이 클래스를 상속받아 테스트를 개발함.@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { RootContextConfig.class }, loader = AnnotationConfigWebContextLoader.class) @WebAppConfiguration public class SpringTestSupport { @Autowired protected WebApplicationContext wac; protected MockM..
Junit 5 & Spring Test을 이용한 TDD 환경 세팅기본 세팅@ExtendWith(SpringExtension.class) @SpringBootTest(classes = KkApplication.class) @ActiveProfiles("test") public abstract class SpringTestSupport { } TestContext를 사용하려면 위의 SpringTestSupport를 상속받아 테스트 코드를 개발한다.@ExtendWith는 Junit4의 RunWith(SpringRunner.class)와 비슷하다고 생각하면 된다.@SpringBootTest는 @SpringBootApplication이 붙은 애너테이션을 찾아 context를 찾는다.@SpringBootApplic..