실행 프로세스
- main() 메소드 실행
- main() 메소드 내의 SpringApplication.run()
- 스프링 부트 앱에 대해 부트스트래핑 수행
- long startTime = System.nanoTime() to calculate the time taken by Spring boot application
- 스프링 부트 실행을 위한 환경 준비 (dev, prod, qa, uat)
- Print banner (콘솔에 스프링 부트 로고 출력)
- IOC Container 시작 - classpath(default, Web servlet / Reactive)의 ApplicationContext
context = createApplicationContext();
return context // Spring IOC container가 참조
어노테이션
@SpringBootApplication =
+ @SpringBootConfiguration = @Configuration
+ @EnableAutoConfiguration
+ @ComponentScan : IoC 컨테이너에 Bean으로 등록
Command Line으로 스프링 부트 실행
mvnw package
jar 파일로 Spring Boot Application 을 패키징하는 wrapper 파일
tartget 폴더에 jar 파일이 생성된다.
jar 파일 실행
target>java -jar springboot-shop-0.0.1-SNAPSHOT.jar
만약 pc내의 java 버전과 프로젝트 java 버전이 맞지 않을 경우 에러 발생
..has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
JAVA 버전 변경이 안 되는 경우 (환경변수를 바꿔도 안 될 때)
Window10 64비트 환경에서 여러 버전의 JAVA 설치 시 버전변경이 되지 않아 해결하는 과정 단순히 환경변수를 변경하면 해결이 될 줄 알았는데 해결이 안 되는 경우가 있다. 이것저것 하면서 해결했
gogoma.tistory.com
또 다른 방법
mvnw spring-boot:run
war 패키지파일 배포
Building Real-Time REST APIs with Spring Boot - Blog App
Learn building REST API’s using Spring Boot, Spring Security, JWT, Spring Data JPA, Hibernate, MySQL and Deploy on AWS
www.udemy.com
localhost:8080/{war 파일 명}/{url name}
Embedded Servers
내장 서버 바꾸기
pom.xml
(Project Object Model)
기본적으로 spring-boot-starter-web 에 tomcat 이 내장되어 있습니다.
Tomcat 대신 Jetty 사용하기
참고 강의
Building Real-Time REST APIs with Spring Boot - Blog App
Learn building REST API’s using Spring Boot, Spring Security, JWT, Spring Data JPA, Hibernate, MySQL and Deploy on AWS
www.udemy.com
'Back-end > Spring Boot + REST API' 카테고리의 다른 글
스프링부트 API JPA 최적화 ToOne 관계 (N+1 문제) , 페치 조인 (0) | 2023.12.19 |
---|---|
Spring Boot 시큐리티 + JWT 흐름 정리 (0) | 2022.11.23 |
Spring boot - blog application (REST API) : AWS RDS, Elastic Beanstalk (0) | 2022.09.08 |
Spring boot - blog application (REST API) : Swagger REST API Documentation (0) | 2022.08.09 |
Spring boot - blog application (REST API) : Versioning (버저닝) (0) | 2022.08.04 |
댓글