스프링부트 만들기
https://tomcat.apache.org/download-90.cgi
zip 파일 안에 라이브러리만 있음
https://search.maven.org/artifact/org.apache.tomcat.embed/tomcat-embed-jasper/9.0.62/jar
DSL (Domain Specific Language)
// 임베디드 톰캣 서버 라이브러리
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.62'
tomcat-embed 검색
https://kaminion.tistory.com/41
최소 세팅
package com.eomcs.mylist;
import java.io.File;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;
public class App {
public static void main(String[] args) throws Exception {
Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
//tomcat.setBaseDir(webappDirLocation); // 톰캣 서버가 작업하는 동안 사용할 디렉토리를 지정
// 웹애플리케이션의 context path와 실제 디렉토리를 지정한다.
StandardContext ctx = (StandardContext) tomcat.addWebapp("/",
new File("./src/main/webapp").getAbsolutePath());
// File additionWebInfClass = new File("target/classes");
//
// WebResourceRoot resources = new StandardRoot(ctx);
// resources.addPreResources(new DirResourceSet(resources, "/WEB-INF/classes",
// additionWebInfClass.getAbsolutePath(), "/"));
//
// ctx.setResources(resources);
tomcat.start();
tomcat.getServer().await();
}
}
http://localhost:8080/index.html
안 됨...
8.대로 낮추기
https://search.maven.org/artifact/org.apache.tomcat.embed/tomcat-embed-jasper/8.5.78/jar
http://localhost:8080/index.html
9점대 버전 안 되면 8점대 버전으로 해보고....
tomcat-embed 9 protocolhandler 검색
tomcat.getConnector(); // 톰캣 서버 9버전부터는 기본 Connector를 생성하지 않는다. 개발자가 직접 생성해야 한다.
http://localhost:8080/jsp/footer.jsp
jsp는 됨
Tomcat - webapps
id 'org.springframework.boot' version '2.6.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
application.properties 복붙하기
spring boot jsp 설정 검색