본문 바로가기
728x90

spring boot3

Spring boot port * port 번호 바꾸고 싶은 경우 > application.properties 에 추가 server.port = 포트번호 * 랜덤 포트 번호 사용하고 싶은 경우 > application.properties 에 추가 server.port = 0 /* * ${random.int} 등을 쓰면 안됨 > 이 경우 사용하지 못하는 port를 부여할 수 있음 * > 0의 경우 가용범위 내의 랜덤포트를 부여 */ * 랜덤포트 사용하는 방법 1 @Component public class RunListener implements ApplicationListener { @Override public void onApplicationEvent(ServletWebServerInitializedEvent event) { Ser.. 2022. 1. 31.
Spring boot 내장 Servlet Container 소스코드 public static void main(String[] args) throws LifecycleException { Tomcat tomcat = new Tomcat();//톰캣 객체 생성 tomcat.setPort(8080);//포트 설정 Context context= tomcat.addContext("/", "/"); HttpServlet servlet = new HttpServlet() {//서블릿 만들기 @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter printWriter = resp.getWriter.. 2022. 1. 29.
Spring Boot 기초 -1 Spring boot? 제품 수준의 스프링 기반의 독립적인 어플리케이션을 만들기 위한 프레임워크 - 스프링 개발 시 더 빠르고 더 폭넓은 사용성 제공 - 기본적인 설정을 제공하며 쉽고 빠르게 설정을 변경할 수 있음 - 대규모 프로젝트 클래스(예: 내장 서버, 보안, 메트릭, 상태 확인 및 외부 구성)에 공통적인 다양한 기능 제공 - 코드 생성이 전혀 없고 XML 구성이 필요하지 않음 * 기본 pom.xml 구성 4.0.0 com.example myproject 0.0.1-SNAPSHOT org.springframework.boot spring-boot-starter-parent 2.0.3.RELEASE org.springframework.boot spring-boot-starter-web org.spri.. 2022. 1. 1.
728x90