본문 바로가기

Programming

(12)
[Spring Boot] 정적 컨텐츠 만들기 (vscode) 정적 콘텐츠 만들기 Spring boot는 기본적으로 src/main/resources/static 폴더의 파일을 정적으로 제공한다. 예를 들어 static 폴더 안에 다음과 같이 hello.html을 만들고 다음과 같이 작성한다면 localhost:포트번호/hello.html로 해당 정적콘텐츠를 확인할 수 있는 것이다.
[Spring Boot] 빌드 / 실행시키기 (vscode) 터미널 실행 ( ctrl + ` ) 루트에서 gradlew 파일로 이동 ./gradlew build​ 빌드완료 빌드 확인 jar 파일 실행 java -jar hello-spring-0.0.1-SNAPSHOT.jar 이제 서버를 배포할 때는 해당 jar 파일만 배포해 주면 java -jar를 통해 서버를 실행시킬 수 있다. 트러블슈팅 만약 포트관련 에러가 발생한다면 이미 해당 포트를 사용중일 수 있으니 다음 글을 참고하자. https://immose93.tistory.com/11 Port 8080을 사용중인 프로세스 kill하는 방법 이클립스로 Spring 프로젝트를 처음 세팅하던 중, Tomcat 서버를 설정하고 실행하는 순간 위의 에러를 맞이하게 되었다. 처음엔 당황스러웠지만, cmd 창에서 netst..
[Spring Boot] View 환경설정 (vscode) 정적 페이지 띄우기 정적 페이지 생성 ~/src/main/resources/static/index.html view 코드 작성 (index.html) Hello hello 서버 실행 localhost 확인 (아직 /hello 는 경로 컨트롤러 세팅을 해주지않아 에러 발생) Thymeleaf를 활용한 컨트롤러 및 View 설정 컨트롤러 생성 컨트롤러 코드 작성 (HelloController.java) package hello.hellospring.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.G..
[Spring Boot] spring boot 를 vscode 에서 빌드 및 실행하는 방법 1. Java 설치 ( 17 ) https://www.oracle.com/java/technologies/downloads/#java17 Download the Latest Java LTS Free Subscribe to Java SE and get the most comprehensive Java support available, with 24/7 global access to the experts. www.oracle.com 2. IDE 설치 ( vscode ) https://code.visualstudio.com/download Download Visual Studio Code - Mac, Linux, Windows Visual Studio Code is free and available on yo..

728x90