월 22,000원
5개월 할부 시다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결스프링 웹 MVC
질문드립니다.
안녕하세요. 아직은 부족하지만 기선님 강의듣고 열심히 공부진행하고 있습니다. 에러관련해서 질문 좀 드리려고 합니다. 소스코드를 똑같이 따라했지만, 테스트 진행시 Bean을 찾지못한다는 에러코드를 만나게 되었습니다. 강의찍으실때와의 버전이 달라서 에러가는 것인지 확인하기가 힘드네요. 그럼 잘 부탁드리겠습니다. 주소 : https://github.com/horange89/mvc_study_web 감사합니다~!
- 미해결스프링 웹 MVC
강의 4:27쯤 질문입니다
@Beanpublic HandlerMapping handlerMapping(){ new로 핸들러매핑생성 return 만든 핸들러매핑 객체 } 이 형식에서 만약 public void handlerMapping(){ new로 핸들러매핑 만듬} 이렇게 void로 끝내고 return 을 안해주면 빈으로 등록이 안되나요?
- 미해결스프링 웹 MVC
@ModelAttribute와 @RequestBody
안녕하세요. 대댓글로 질문을 이어갔는데 누락되었는지 답변이 안달려서 다시 질문드립니다ㅠ @ModelAttribute는 GET방식(url 쿼리 파라미터)이든, POST방식(body 쿼리 파라미터)이든 쿼리 파라미터 방식 (key1=value1&key2=value2&...)은 모두 매핑이 되지만, JSON형태는 매핑이 안돼서, @RequestBody @ModelAttribute를 같이 쓰면 매핑이 안되는 것 맞나요?
- 미해결스프링 웹 MVC
블로그 정리 관련하여 문의 드립니다.
안녕하세요 백기선선생님의 강의를 스프링 프레임워크 핵심 기술을 듣고 현재 웹 MVC 강좌를 듣는 학생입니다. 스프링 프레임워크 핵심 기술 질의 응답에서 블로그 정리를 하셔도 괜찮다는 글을 보고 현재 블로그에 웹 MVC 강좌를 들은 내용을 정리하여 올리고 있는데 직접 문의를 드리고 올리는 것이 맞다고 생각되어 문의를 드립니다. 항상 좋은 강의를 올려 주셔서 감사합니다.
- 미해결스프링 웹 MVC
@RequestBody와 @ModelAttribute
안녕하세요, 수업 잘 보고 있습니다. 저는 Controller에서 RequestMapping을 할 때 습관적으로 @ModelAttribute를 적어주는데요, Client단에서 JSON으로 요청을 보냈을 때, @RequestBody와 함께 @ModelAttribute를 적으면 제대로 바인딩이 안되는 경험을 했습니다. @RequiredArgsConstructor @RestController public class NotificationController { private final NotificationService notificationService; private final NotificationDeleteRequestDtoValidator notificationDeleteRequestDtoValidator; @InitBinder("notificationDeleteRequestDto") public void initBinderForNotificationDeleteRequestDtoValidator(WebDataBinder webDataBinder){ webDataBinder.addValidators(notificationDeleteRequestDtoValidator); } @PostMapping(NOTIFICATION_DELETE_URL) public ResponseEntity deleteNotification(@SessionAccount Account sessionAccount, @Valid @RequestBody @ModelAttribute NotificationDeleteRequestDto notificationDeleteRequestDto, Errors errors){ if(errors.hasErrors()){ return ResponseEntity.badRequest().build(); } // notificationService.deleteNotification(sessionAccount, notificationDeleteRequestDto); return ResponseEntity.ok().build(); } } 이렇게 하면 바인딩이 안되어 null값으로 들어오고, @RequiredArgsConstructor @RestController public class NotificationController { private final NotificationService notificationService; private final NotificationDeleteRequestDtoValidator notificationDeleteRequestDtoValidator; @InitBinder("notificationDeleteRequestDto") public void initBinderForNotificationDeleteRequestDtoValidator(WebDataBinder webDataBinder){ webDataBinder.addValidators(notificationDeleteRequestDtoValidator); } @PostMapping(NOTIFICATION_DELETE_URL) public ResponseEntity deleteNotification(@SessionAccount Account sessionAccount, @Valid @RequestBody NotificationDeleteRequestDto notificationDeleteRequestDto, Errors errors){ if(errors.hasErrors()){ return ResponseEntity.badRequest().build(); } // notificationService.deleteNotification(sessionAccount, notificationDeleteRequestDto); return ResponseEntity.ok().build(); } } 이렇게 하면 바인딩이 잘 되더군요.. @ModelAttribute는 @RequestBody와 같이 쓰면 안되는건가요 원래? 아니면 제가 뭔가 잘못한 게 있는건가요?
- 해결됨스프링 웹 MVC
파일 다운로드 OutputStream / ResponseEntity 차이 질문입니다
안녕하세요 기선님, 항상 좋은 강의 감사드립니다. 강의를 들으면서 오늘 처음으로 궁금한 점이 생겨 질문 드립니다. 저는 강의를 수강하기 전에 파일 다운로드 기능을 구현할 때 아래와 같은 형식으로 Stream 관련 api을 사용하여 다운로드 기능을 구현했었는데요. 아래는 강의를 들으면서 한 코드입니다. 강의를 들으며 오늘 처음 ResponseEntity 를 사용해보면서 문득 궁금점이 생겨, 혼자 예제를 만들어 테스트를 해봤습니다. 혹시 위 두 방식 사이에서 차이점이 있는지 궁금합니다. Stream을 통해 다운로드를 구현하는 방식과 ResponseEntity Body에 File Resource 를 넣어 반환하는 방식이 결과적으로 파일 다운로드하는 것은 같고, 단지 구현하는 방식의 차이일까요?
- 미해결스프링 웹 MVC
강의 프로젝트를 STS나 eclipse로 생성하는 방법 질믄입니다.
안녕하십니까? 기본적인 질문이라 망설이다 올립니다. 저는 STS로 프로젝트를 생성하여 강의를 받으려고 합니다. 아래와 같은 방법으로 프로젝트를 생성하고, 강의의 소스를 해당 폴더를 만들어 진행해도 되는지요? FIle - New - Dynamic Web Project - 프로젝트 생성 - 프로젝트 선택 - Configure - Convert to Maven Project 아니면 File - New - Spring Starter Priject 로 구성하여 사용해야 하는지요? 혹시 제가 잘못 알고 있거나 추가로 설정할 것이 있는지요? 향후, 다른 강의인 "스터디올래" 프로젝트도 위와 같은 것으로 생성하고 진행해도 되는지 문의 드립니다. 감사합니다.
- 해결됨스프링 웹 MVC
add Configuration에서 Tomcat server
Tomcat Server가 없으면 어떻게 해야 할까요?
- 미해결스프링 웹 MVC
JSR 303 애노테이션이 안나옵니다.
따로 무엇을 적용해야하나요?? 강의에서는 딱히 그런거 없었는데 왜 안되는지 모르겠어요ㅠㅠ 인터넷 서칭해 보니까 dependency hibernate를 추가하라고 하는데 쌤은 추가없이 사용하셔서 여쭤봅니다!! 참고로 spring framework boot는 2.3.0 릴리즈 사용하고 있습니다. 혹시 몰라서 pom.xml 내용 올립니다. <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.0.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>me.whiteship</groupId> <artifactId>demo-web-mvc</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo-web-mvc</name> <description>Demo project for Spring Boot</description> <properties> <java.version>11</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>
- 해결됨스프링 웹 MVC
JPA 설정후 JUnit Test NullpointerException 나와야하는데...
DefaultHandlerExceptionResolver 계속 이렇게 나와서 다음 Test도 제대로 진행 안됩니다ㅠㅠ 도와주세요 Person package me.whiteship.demobootweb;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.Id;@Entitypublic class Person { @Id @GeneratedValue private Long id; private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; }} PersonRepository package me.whiteship.demobootweb;import org.springframework.data.jpa.repository.JpaRepository;public interface PersonRepository extends JpaRepository<Person, Long> {} SampleController package me.whiteship.demobootweb;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class SampleController { @GetMapping("/hello") public String hello(@RequestParam("id") Person person){ return "hello " + person.getName(); }} WebConfig package me.whiteship.demobootweb;import org.springframework.context.annotation.Configuration;import org.springframework.format.FormatterRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;@Configurationpublic class WebConfig implements WebMvcConfigurer {} SampleControllerTest package me.whiteship.demobootweb;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.test.context.junit4.SpringRunner;import org.springframework.test.web.servlet.MockMvc;import static org.junit.Assert.*;import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;@RunWith(SpringRunner.class)@SpringBootTest@AutoConfigureMockMvcpublic class SampleControllerTest { @Autowired MockMvc mockMvc; @Test public void hello() throws Exception { this.mockMvc.perform(get("/hello") .param("id", "1")) .andDo(print()) .andExpect(content().string("hello keesun")); }} pom.xml <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>me.whiteship</groupId> <artifactId>demo-boot-web</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo-boot-web</name> <description>Demo project for Spring Boot</description> <properties> <java.version>11</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project> 코드는 이러합니다ㅠㅠ 감사합니다 에러내용: "C:\Program Files\Java\jdk-11.0.7\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.1\lib\idea_rt.jar=49909:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.1\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.1\plugins\junit\lib\junit5-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.1\plugins\junit\lib\junit-rt.jar;C:\Users\seouz\IdeaProjects\demo-boot-web\target\test-classes;C:\Users\seouz\IdeaProjects\demo-boot-web\target\classes;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.3.1.RELEASE\spring-boot-starter-web-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter\2.3.1.RELEASE\spring-boot-starter-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot\2.3.1.RELEASE\spring-boot-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.3.1.RELEASE\spring-boot-autoconfigure-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.3.1.RELEASE\spring-boot-starter-logging-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\seouz\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\seouz\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;C:\Users\seouz\.m2\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;C:\Users\seouz\.m2\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;C:\Users\seouz\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\seouz\.m2\repository\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.3.1.RELEASE\spring-boot-starter-json-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.11.0\jackson-databind-2.11.0.jar;C:\Users\seouz\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.0\jackson-annotations-2.11.0.jar;C:\Users\seouz\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.11.0\jackson-core-2.11.0.jar;C:\Users\seouz\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.0\jackson-datatype-jdk8-2.11.0.jar;C:\Users\seouz\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.0\jackson-datatype-jsr310-2.11.0.jar;C:\Users\seouz\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.0\jackson-module-parameter-names-2.11.0.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.3.1.RELEASE\spring-boot-starter-tomcat-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.36\tomcat-embed-core-9.0.36.jar;C:\Users\seouz\.m2\repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;C:\Users\seouz\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.36\tomcat-embed-websocket-9.0.36.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-web\5.2.7.RELEASE\spring-web-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-beans\5.2.7.RELEASE\spring-beans-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-webmvc\5.2.7.RELEASE\spring-webmvc-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-aop\5.2.7.RELEASE\spring-aop-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-context\5.2.7.RELEASE\spring-context-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-expression\5.2.7.RELEASE\spring-expression-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.3.1.RELEASE\spring-boot-starter-data-jpa-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.3.1.RELEASE\spring-boot-starter-aop-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\aspectj\aspectjweaver\1.9.5\aspectjweaver-1.9.5.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.3.1.RELEASE\spring-boot-starter-jdbc-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-jdbc\5.2.7.RELEASE\spring-jdbc-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\jakarta\transaction\jakarta.transaction-api\1.3.3\jakarta.transaction-api-1.3.3.jar;C:\Users\seouz\.m2\repository\jakarta\persistence\jakarta.persistence-api\2.2.3\jakarta.persistence-api-2.2.3.jar;C:\Users\seouz\.m2\repository\org\hibernate\hibernate-core\5.4.17.Final\hibernate-core-5.4.17.Final.jar;C:\Users\seouz\.m2\repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;C:\Users\seouz\.m2\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;C:\Users\seouz\.m2\repository\net\bytebuddy\byte-buddy\1.10.11\byte-buddy-1.10.11.jar;C:\Users\seouz\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\seouz\.m2\repository\org\jboss\jandex\2.1.3.Final\jandex-2.1.3.Final.jar;C:\Users\seouz\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\Users\seouz\.m2\repository\org\dom4j\dom4j\2.1.3\dom4j-2.1.3.jar;C:\Users\seouz\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.1.0.Final\hibernate-commons-annotations-5.1.0.Final.jar;C:\Users\seouz\.m2\repository\org\glassfish\jaxb\jaxb-runtime\2.3.3\jaxb-runtime-2.3.3.jar;C:\Users\seouz\.m2\repository\org\glassfish\jaxb\txw2\2.3.3\txw2-2.3.3.jar;C:\Users\seouz\.m2\repository\com\sun\istack\istack-commons-runtime\3.0.11\istack-commons-runtime-3.0.11.jar;C:\Users\seouz\.m2\repository\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;C:\Users\seouz\.m2\repository\org\springframework\data\spring-data-jpa\2.3.1.RELEASE\spring-data-jpa-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\data\spring-data-commons\2.3.1.RELEASE\spring-data-commons-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-orm\5.2.7.RELEASE\spring-orm-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-tx\5.2.7.RELEASE\spring-tx-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-aspects\5.2.7.RELEASE\spring-aspects-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\com\h2database\h2\1.4.200\h2-1.4.200.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-starter-test\2.3.1.RELEASE\spring-boot-starter-test-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-test\2.3.1.RELEASE\spring-boot-test-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\boot\spring-boot-test-autoconfigure\2.3.1.RELEASE\spring-boot-test-autoconfigure-2.3.1.RELEASE.jar;C:\Users\seouz\.m2\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;C:\Users\seouz\.m2\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;C:\Users\seouz\.m2\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;C:\Users\seouz\.m2\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;C:\Users\seouz\.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.3\jakarta.xml.bind-api-2.3.3.jar;C:\Users\seouz\.m2\repository\jakarta\activation\jakarta.activation-api\1.2.2\jakarta.activation-api-1.2.2.jar;C:\Users\seouz\.m2\repository\org\assertj\assertj-core\3.16.1\assertj-core-3.16.1.jar;C:\Users\seouz\.m2\repository\org\hamcrest\hamcrest\2.2\hamcrest-2.2.jar;C:\Users\seouz\.m2\repository\org\junit\jupiter\junit-jupiter\5.6.2\junit-jupiter-5.6.2.jar;C:\Users\seouz\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.6.2\junit-jupiter-api-5.6.2.jar;C:\Users\seouz\.m2\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;C:\Users\seouz\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\seouz\.m2\repository\org\junit\platform\junit-platform-commons\1.6.2\junit-platform-commons-1.6.2.jar;C:\Users\seouz\.m2\repository\org\junit\jupiter\junit-jupiter-params\5.6.2\junit-jupiter-params-5.6.2.jar;C:\Users\seouz\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.6.2\junit-jupiter-engine-5.6.2.jar;C:\Users\seouz\.m2\repository\org\junit\platform\junit-platform-engine\1.6.2\junit-platform-engine-1.6.2.jar;C:\Users\seouz\.m2\repository\org\mockito\mockito-core\3.3.3\mockito-core-3.3.3.jar;C:\Users\seouz\.m2\repository\net\bytebuddy\byte-buddy-agent\1.10.11\byte-buddy-agent-1.10.11.jar;C:\Users\seouz\.m2\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;C:\Users\seouz\.m2\repository\org\mockito\mockito-junit-jupiter\3.3.3\mockito-junit-jupiter-3.3.3.jar;C:\Users\seouz\.m2\repository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;C:\Users\seouz\.m2\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-core\5.2.7.RELEASE\spring-core-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-jcl\5.2.7.RELEASE\spring-jcl-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\springframework\spring-test\5.2.7.RELEASE\spring-test-5.2.7.RELEASE.jar;C:\Users\seouz\.m2\repository\org\xmlunit\xmlunit-core\2.7.0\xmlunit-core-2.7.0.jar;C:\Users\seouz\.m2\repository\junit\junit\4.13\junit-4.13.jar;C:\Users\seouz\.m2\repository\org\hamcrest\hamcrest-core\2.2\hamcrest-core-2.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 me.whiteship.demobootweb.SampleControllerTest,hello 15:12:57.894 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class me.whiteship.demobootweb.SampleControllerTest] 15:12:57.914 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] 15:12:57.941 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)] 15:12:58.115 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [me.whiteship.demobootweb.SampleControllerTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper] 15:12:58.190 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [me.whiteship.demobootweb.SampleControllerTest], using SpringBootContextLoader 15:12:58.220 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [me.whiteship.demobootweb.SampleControllerTest]: class path resource [me/whiteship/demobootweb/SampleControllerTest-context.xml] does not exist 15:12:58.224 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [me.whiteship.demobootweb.SampleControllerTest]: class path resource [me/whiteship/demobootweb/SampleControllerTestContext.groovy] does not exist 15:12:58.224 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [me.whiteship.demobootweb.SampleControllerTest]: no resource found for suffixes {-context.xml, Context.groovy}. 15:12:58.231 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [me.whiteship.demobootweb.SampleControllerTest]: SampleControllerTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration. 15:12:58.548 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [me.whiteship.demobootweb.SampleControllerTest] 15:12:58.864 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\Users\seouz\IdeaProjects\demo-boot-web\target\classes\me\whiteship\demobootweb\DemoBootWebApplication.class] 15:12:58.925 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration me.whiteship.demobootweb.DemoBootWebApplication for test class me.whiteship.demobootweb.SampleControllerTest 15:12:59.603 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [me.whiteship.demobootweb.SampleControllerTest]: using defaults. 15:12:59.604 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] 15:12:59.674 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@418c5a9c, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@18e36d14, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@5082d622, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@13d4992d, org.springframework.test.context.support.DirtiesContextTestExecutionListener@302f7971, org.springframework.test.context.transaction.TransactionalTestExecutionListener@332729ad, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@75d2da2d, org.springframework.test.context.event.EventPublishingTestExecutionListener@4278284b, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@9573584, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@3370f42, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@6057aebb, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@63eef88a, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@53251a66, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@6853425f] 15:12:59.690 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.697 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.701 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.703 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.703 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.703 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.740 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.740 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.746 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.746 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.771 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.771 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.815 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@36a5cabc testClass = SampleControllerTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@432038ec testClass = SampleControllerTest, locations = '{}', classes = '{class me.whiteship.demobootweb.DemoBootWebApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[[ImportsContextCustomizer@7daa0fbd key = [org.springframework.boot.test.autoconfigure.web.servlet.MockMvcAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebClientAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebDriverAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcSecurityConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@76ed1b7c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6236eb5f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@ba54932, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@4b3fa0b3, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@7e9131d5, org.springframework.boot.test.context.SpringBootTestArgs@1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null]. 15:12:59.823 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.823 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [me.whiteship.demobootweb.SampleControllerTest] 15:12:59.972 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true} . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.3.1.RELEASE) 2020-06-20 15:13:02.875 INFO 13492 --- [ main] m.w.demobootweb.SampleControllerTest : Starting SampleControllerTest on DESKTOP-M96FNV1 with PID 13492 (started by seouz in C:\Users\seouz\IdeaProjects\demo-boot-web) 2020-06-20 15:13:02.884 INFO 13492 --- [ main] m.w.demobootweb.SampleControllerTest : No active profile set, falling back to default profiles: default 2020-06-20 15:13:04.725 INFO 13492 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode. 2020-06-20 15:13:04.887 INFO 13492 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 137ms. Found 1 JPA repository interfaces. 2020-06-20 15:13:07.525 INFO 13492 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-06-20 15:13:07.555 INFO 13492 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2020-06-20 15:13:08.022 INFO 13492 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2020-06-20 15:13:08.212 INFO 13492 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2020-06-20 15:13:08.436 INFO 13492 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.17.Final 2020-06-20 15:13:09.048 WARN 13492 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2020-06-20 15:13:09.356 INFO 13492 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 2020-06-20 15:13:10.381 INFO 13492 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2020-06-20 15:13:12.576 INFO 13492 --- [ main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet '' 2020-06-20 15:13:12.585 INFO 13492 --- [ main] o.s.t.web.servlet.TestDispatcherServlet : Initializing Servlet '' 2020-06-20 15:13:12.670 INFO 13492 --- [ main] o.s.t.web.servlet.TestDispatcherServlet : Completed initialization in 85 ms 2020-06-20 15:13:12.704 INFO 13492 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories… 2020-06-20 15:13:14.772 INFO 13492 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2020-06-20 15:13:14.794 INFO 13492 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2020-06-20 15:13:15.281 INFO 13492 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized! 2020-06-20 15:13:15.303 INFO 13492 --- [ main] m.w.demobootweb.SampleControllerTest : Started SampleControllerTest in 15.176 seconds (JVM running for 20.434) 2020-06-20 15:13:15.877 WARN 13492 --- [ main] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'me.whiteship.demobootweb.Person'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'me.whiteship.demobootweb.Person': no matching editors or conversion strategy found] MockHttpServletRequest: HTTP Method = GET Request URI = /hello Parameters = {id=[1]} Headers = [] Body = null Session Attrs = {} Handler: Type = me.whiteship.demobootweb.SampleController Method = me.whiteship.demobootweb.SampleController#hello(Person) Async: Async started = false Async result = null Resolved Exception: Type = org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException ModelAndView: View name = null View = null Model = null FlashMap: Attributes = null MockHttpServletResponse: Status = 500 Error message = null Headers = [] Content type = null Body = Forwarded URL = null Redirected URL = null Cookies = [] MockHttpServletRequest: HTTP Method = GET Request URI = /hello Parameters = {id=[1]} Headers = [] Body = null Session Attrs = {} Handler: Type = me.whiteship.demobootweb.SampleController Method = me.whiteship.demobootweb.SampleController#hello(Person) Async: Async started = false Async result = null Resolved Exception: Type = org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException ModelAndView: View name = null View = null Model = null FlashMap: Attributes = null MockHttpServletResponse: Status = 500 Error message = null Headers = [] Content type = null Body = Forwarded URL = null Redirected URL = null Cookies = [] java.lang.AssertionError: Response content Expected :hello keesun Actual : <Click to see difference> at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:59) at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:122) at org.springframework.test.web.servlet.result.ContentResultMatchers.lambda$string$4(ContentResultMatchers.java:136) at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:196) at me.whiteship.demobootweb.SampleControllerTest.hello(SampleControllerTest.java:30) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58) 2020-06-20 15:13:16.190 INFO 13492 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2020-06-20 15:13:16.192 INFO 13492 --- [extShutdownHook] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' 2020-06-20 15:13:16.218 INFO 13492 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 2020-06-20 15:13:16.220 INFO 13492 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2020-06-20 15:13:16.237 INFO 13492 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. Process finished with exit code -1
- 미해결스프링 웹 MVC
web.xml 자동완성기능이 안되요..
구글링해서 찾아보았으나 web.xml의 자동완성이 안되는 현상은 찾을 수 가 없었습니다. 어떻게 해야할까요?
- 해결됨스프링 웹 MVC
shutdown port 번호가 안맞는데 어떻게 수정해야할까요?
16-Jun-2020 20:01:53.523 SEVERE [main] org.apache.catalina.startup.Catalina.stopServer 셧다운 포트가 설정되지 않았습니다. OS 시그널을 통해 서버를 셧다운합니다. 서버는 아직 셧다운되지 않았습니다. "destroy" 찍어보려다가 도랑에 빠졌습니다. 도와주세요..
- 해결됨스프링 웹 MVC
maven dependency 추가가 안되네요..
import가 안되서 확인해보니까 pom.xml에서도 에러가 있었어요 .. 빨간줄로 뜨면서 에러가 나고 적용이 안되는것 같습니다. 어떻게 해결해야 할까요..
- 미해결스프링 웹 MVC
aop, interceptor 차이점
aop 와 interceptor 모두 어느 특정 핸들러를 실행 전 실행 후 어떠한 로직을 수행하도록 만들 수 있는데 기능상의 차이점이 없는것 같습니다. interceptor는 spring mvc에서 http 요청에 대한 처리를 하기위해 사용되는것이고 aop는 관점을 모듈화하여 적용하는것으로 기능은 비슷하지만interceptor는 웹에대한 처리를 하기위해서 aop는 스프링 애플리케이션에서 특정 메서드 호출 전 후처리에 필요 하다고 생각하면 될까요?
- 미해결스프링 웹 MVC
WebMvcConfigurer 1부 Formatter - localhost:8080/hello?name=keesun
package me.whiteship.web_mvc_onfigurer;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class SampleController { @GetMapping("/hello") public String hello(@RequestParam("name") Person person) { return "hello " + person.getName(); }} package me.whiteship.web_mvc_onfigurer;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;import org.springframework.test.context.junit4.SpringRunner;import org.springframework.test.web.servlet.MockMvc;import static org.junit.Assert.*;import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;@RunWith(SpringRunner.class)@WebMvcTestpublic class SampleControllerTest { @Autowired MockMvc mockMvc; @Test public void hello() throws Exception { this.mockMvc.perform(get("/hello") .param("name", "keesun")) .andDo(print()) .andExpect(content().string("hello keesun")); }} package me.whiteship.web_mvc_onfigurer;import org.springframework.context.annotation.Configuration;import org.springframework.format.FormatterRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;@Configurationpublic class WebConfig implements WebMvcConfigurer {} package me.whiteship.web_mvc_onfigurer;public class Person { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; }} package me.whiteship.web_mvc_onfigurer;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;import org.springframework.test.context.junit4.SpringRunner;import org.springframework.test.web.servlet.MockMvc;import static org.junit.Assert.*;import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;@RunWith(SpringRunner.class)@WebMvcTestpublic class SampleControllerTest { @Autowired MockMvc mockMvc; @Test public void hello() throws Exception { this.mockMvc.perform(get("/hello") .param("name", "keesun")) .andDo(print()) .andExpect(content().string("hello keesun")); }} junit 4로 테스트 결과 아래와 같이 에러가 발생합니다. Resolved Exception: Type = org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException MockHttpServletRequest: HTTP Method = GET Request URI = /hello Parameters = {name=[keesun]} Headers = [] Body = <no character encoding set> Session Attrs = {} Handler: Type = me.whiteship.web_mvc_onfigurer.SampleController Method = me.whiteship.web_mvc_onfigurer.SampleController#hello(Person) Async: Async started = false Async result = null Resolved Exception: Type = org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException ModelAndView: View name = null View = null Model = null FlashMap: Attributes = null MockHttpServletResponse: Status = 500 Error message = null Headers = [] Content type = null Body = Forwarded URL = null Redirected URL = null Cookies = [] MockHttpServletRequest: HTTP Method = GET Request URI = /hello Parameters = {name=[keesun]} Headers = [] Body = <no character encoding set> Session Attrs = {} Handler: Type = me.whiteship.web_mvc_onfigurer.SampleController Method = me.whiteship.web_mvc_onfigurer.SampleController#hello(Person) Async: Async started = false Async result = null Resolved Exception: Type = org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException ModelAndView: View name = null View = null Model = null FlashMap: Attributes = null MockHttpServletResponse: Status = 500 Error message = null Headers = [] Content type = null Body = Forwarded URL = null Redirected URL = null Cookies = [] java.lang.AssertionError: Response content Expected :hello keesun Actual : <Click to see difference> 소스 확인 좀 부탁드려도 될까요?
- 해결됨스프링 웹 MVC
스프링 부트 2.3.0 이상은 의존성을 추가해주셔야 합니다.
스프링 이니셜라이저로 프로젝트 생성후 학습하실때, 2.3 버전 이상은 의존성을 추가해주셔야 합니다. 해당 내용 관한 백기선 선생님 유투부 링크 남깁니다 ^^7 https://youtu.be/cP8TwMV4LjE
- 미해결스프링 웹 MVC
Spring MVC @Valid 오작동 관련
안녕하세요 강의 잘 봤습니다. 좋은 강의 고맙습니다. 질문 있어 이렇게 글을 남깁니다. Spring Validation이 원활하게 되지 않습니다. PostMan/SpringUnitTest를 통해도 되지 않습니다. 제가 분명 어떤것을 빼먹은 것 같지만 구글링해도 해결되지 않아, 이렇게 게실글을 남깁니다. UserControllerTest는 '제 생각에는' 실패 해야하는데, 계속 성공합니다. 제 코드는 아래와 같습니다. UserController package net.glaso.rest.practice.user; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.WebRequest; import javax.validation.Valid; @RestController @RequestMapping("user-info") public class UserController { @RequestMapping public String test() { System.out.println("test"); return "{\"test\":\"test\"}"; } @PostMapping public ResponseEntity<UserInfo> create(@Valid @RequestBody UserInfo userInfo, BindingResult result, @RequestHeader HttpHeaders headers, WebRequest request ) { if ( result.hasErrors() ) { System.out.println( "error" ); throw new IllegalArgumentException( "test" ); } System.out.println( userInfo ); System.out.println( request.isSecure()); System.out.println( headers.get( HttpHeaders.CONTENT_TYPE ) ); return ResponseEntity.ok( userInfo ); } } UserInfo package net.glaso.rest.practice.user; import javax.validation.constraints.*; public class UserInfo { @NotBlank private int seqId; @NotBlank private String userId; @NotBlank private String name; @NotBlank private String test; .. getter/setter UserControllerTest @RunWith(SpringRunner.class) @WebAppConfiguration @ContextConfiguration(classes= {WebConfig.class, AppConfig.class}) public class UserControllerTest { private MockMvc mockMvc; private ObjectMapper objectMapper; @Before public void init() { this.mockMvc = MockMvcBuilders.standaloneSetup( new UserController() ).build(); this.objectMapper = new ObjectMapper(); objectMapper.setSerializationInclusion( JsonInclude.Include.NON_NULL ); } @Test public void create() throws Exception { UserInfo userInfo = new UserInfo(); userInfo.setName( "shin" ); userInfo.setUserId( " " ); String jsonData = objectMapper.writeValueAsString( userInfo ); System.out.println( "reqData : " + jsonData ); mockMvc.perform( post( "/user-info" ) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE ) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE ) .header(HttpHeaders.CONTENT_ENCODING, "UTF-8" ) .content( jsonData ) ) .andDo( print() ) .andExpect( status().isOk() ); } } AppConfig @Configuration @ComponentScan( basePackages = "net.glaso.rest.practice", useDefaultFilters=false, excludeFilters = @ComponentScan.Filter(Controller.class), includeFilters = { @ComponentScan.Filter(ControllerAdvice.class), @ComponentScan.Filter(Service.class), @ComponentScan.Filter(Repository.class) } ) @EnableTransactionManagement(order = 200) public class AppConfig{ } WebConfig @Configuration @ComponentScan( basePackages="net.glaso.rest.practice", useDefaultFilters=false, includeFilters=@ComponentScan.Filter(Controller.class) ) @EnableWebMvc public class WebConfig implements WebMvcConfigurer { } 사용라이브러리 javax.validation-api 2.0 jackson Servlet 4.0 Java 8 Spring context/context-support/core/expression/jdbc/test/tx/web/webmvc/aop/beans 고맙습니다.
- 미해결스프링 웹 MVC
질문있습니다.
강의를 보고 소스를 똑같이 입력하였는데요. 테스트 결과값이 다르게 나오게되어 문의드립니다. java.lang.AssertionError: Response content expected:<hello keesun> but was:<hello 1> Expected :hello keesun Actual :hello 1 break point를 찍고 person객체와 savedPerson객체가 동일한 값이 들어있는걸 확인하였습니다. 컨버터가 동작을 안한건지 테스트 결과값을 toString을 찍어보면 id=null, name='1'로 나옵니다. 뭐가 문제인건가요?..ㅠ 테스트 코드도 첨부해드립니다. @SpringBootTest@AutoConfigureMockMvcpublic class SampleControllerTest { @Autowired MockMvc mockMvc; @Autowired PersonRepository personRepository; @Test public void hello() throws Exception { Person person = new Person(); person.setName("keesun"); Person savedPerson = personRepository.save(person); this.mockMvc.perform(get("/hello") .param("id", savedPerson.getId().toString())) .andDo(print()) .andExpect(content().string("hello keesun")); }}
- 스프링 웹 MVC
파일 업로드, 다운로드 테스트 관련 질문입니다!
삭제된 글입니다
- 해결됨스프링 웹 MVC
eventForm() 테스트 에러
안녕하세요 기선님, 좋은 강의들 덕분에 스프링 열심히 공부하고 있습니다. 영상대로 따라했을 때 웹페이지 실행에는 문제가 없었습니다. 마지막 eventForm()을 테스트 하기위해 작성하신 코드를 똑같이 실행해 보았는데 테스트 코드의 .andExpect(view().name("/events/form")) 이 return "events/form"; 과 기댓값이 다르다고 테스트 fail이 되더군요. 둘중 하나를 서로에게 맞췄을 때는 제대로 테스트가 돌아갔습니다. 영상에서는 테스트가 제대로 돌아가는 것 같은데 어떤 이유에서인지 궁금합니다. 오류 메세지 입니다. java.lang.AssertionError: View name Expected :/events/form Actual :events/form <Click to see difference>