728x90 전체 글86 HtmlUnit HtmlUnit : html을 단위테스트하기 위한 tool > 웹 클라이언트로 요청을 보내고 결과를 받아서 내용을 HtmlPage를 통해 값을 확인할 수 있음 > 브라우저 타입을 줄 수 있음 > 엘리먼트 값을 가지고와서 값을 확인할 수 있음 예제) Controller, template : 전과 동일 https://developing-countries.tistory.com/64 TestCode @RunWith(SpringRunner.class) @WebMvcTest(SampleController.class) public class SampleControllerTest { @Autowired WebClient webClient; @Test public void hello() throws IOException.. 2022. 2. 28. Thymeleaf 탬플릿 엔진 JSP 단점 > 서블릿 엔진이 JSP 스펙을 구현하여 최종적인 뷰가 나옴 - 랜더링된 결과를 확인하기 힘듬 > Thymeleaf 를 사용하면 Thymeleaf가 독자적으로 (Servlet Container의 개입 없이) View를 완성하여 랜더링된 결과를 확인하기 쉬움 (웹서버를 안띄워도 mockMVC만으로 test가 가능하다.) 예제) controller @Controller public class SampleController { @GetMapping("/hello") public String hello(Model model){ model.addAttribute("name", "sangguk"); //model > attribute return "hello"; //view name } }.. 2022. 2. 28. WebJar WebJar > 클라이언트에서 사용하는 javascript library react.js, vue.js 등을 jar파일로 다룰 수 있음 > jar파일을 dependency로 추가하여 해당 jar의 css, javascript를 참조할 수 있음 ex) Hello, SangGuk >webjar-locator-core dependency를 추가해주는 경우 버전을 생략할 수 있다. * 결과 2022. 2. 27. Spring 정적 리소스 맵핑 - 기본 리소스 위치 classpath:/static classpath:/public classpath:/resources/ classpath:/META-INF/resource/ > 위 경로에 요청에 해당하는 리소스가 있다면 자동으로 매핑하여 리턴 ex) https://localhost:8080/hello.html 이라는 요청시 /static/hello.html이 있는 경우 해당 리소스를 리턴 * 맵핑설정을 변경하고 싶은 경우 spring.mvc.static-path-pattern=/sangguk/** 이제는 https://localhost:8080/hello.html > https://localhost:8080/sangguk/hello.html 으로 요청해야함 2022. 2. 27. 이전 1 ··· 4 5 6 7 8 9 10 ··· 22 다음 728x90