728x90 반응형 스프링 Spring85 [스프링 웹 개발 기초] MVC와 템플릿 엔진 MVC와 템플릿 엔진 view : 화면을 그리는데 모든 역량을 집중 Controller : 비즈니스 로직, 내분 처리에 집중 resource > templates > hello-template.html 생성 hello! empty // HelloController.java @GetMapping("hello-mvc") // @RequestParam : 외부에서 파라미터를 받을거다 public String helloMvc(@RequestParam("name") String name, Model model) { model.addAttribute("name", name); return "hello-template"; } 결과 로그를 확인 하면 아래와 같은 WARN을 발견할 수 있다. WARN 27040 --- .. 2022. 1. 9. [스프링 웹 개발 기초] 정적 컨텐츠 정적 컨텐츠 스프링 부튼 정적 컨테츠 기능 https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/html/spring-bootfeatures.html#boot-features-spring-mvc-static-content 7.1.5. Static Content By default, Spring Boot serves static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext. It uses the ResourceHttpRequestHa.. 2022. 1. 8. [프로젝트 환경설정] 빌드하고 실행하기 IntelliJ 실행을 멈춘뒤에 다음을 진행 1. cmd 창에서 아래 명령어 실행 1) gradlew build 2) cd build/libs 3) java -jar hello-spring-0.0.1-SNAPSHOT.jar 4) 실행 확인 2. Git bash 에서 실행 1. ./gradlew build 2. cd build/libs 3. java -jar hello-spring-0.0.1-SNAPSHOT.jar 4. 실행 확인 ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk-11.0.11\bin Please set the JAVA_HOME variable in your environment to match the lo.. 2022. 1. 8. [프로젝트 환경설정] View 환경설정 View 환경설정 Welcome Page 만들기 위치 : resource > static > index.html Hello hello URL : http://localhost:8080 접속 결과 스프링 부트가 제공하는 Welcome Page 기능 참고 https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/html/spring-boot-features.html#boot-features-spring-mvc-welcome-page 7.1.6. Welcome Page Spring Boot supports both static and templated welcome pages. It first looks for an index.html file in t.. 2022. 1. 7. [프로젝트 환경설정] 프로젝트 생성 https://start.spring.io/ 에 접속하여 아래와 같이 작성후 GENERATE를 눌러 다운을 받는다. 받은 파일을 IntelliJ로 실행 IntelliJ버전은 Gradle을 통해서 실행하는 것이 기본 설정이며 이렇게 하면 실행속도가 느리다. 설정을 아래와 같이 수정하여 자바로 바로 실행하여 실행속도를 더 빠르게 변경한다. File > Settings... HelloSpringApplication.java 실행 http://localhost:8080/ 에 접속하여 아래와 같이 나오면 제대로 된 것이다. 인프런 강의 "스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술"을 정리한 것 입니다. [무료] 스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술.. 2022. 1. 6. 이전 1 ··· 8 9 10 11 다음 728x90 반응형