아이디어 사용 외부 tomcat 설정 springboot boot 상세 절차

4726 단어 ideaspringboottomcat
  •  maven 프로젝트 를 만 듭 니 다
  • springboot 의존 도입,아래 주석 부분 주의
  • 
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>com.znsd.springboot</groupId>
        <artifactId>springboot-jsp</artifactId>
        <version>1.0-SNAPSHOT</version>
        
        
        <!--      war  -->
        <packaging>war</packaging>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.3.12.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <!--   springboot  tomcat  ,     war    , -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <!--        ,  war    -->
                <scope>provided</scope>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </project>


    다음 그림 작업 을 완료 하고 저장 하면 됩 니 다.

    tomcat 시작 설정




    보기 해석 기 설정

    springboot 메 인 프로그램 만 들 기
    
    @SpringBootApplication
    public class SpringBootMain {
        public static void main(String[] args) {
            SpringApplication.run(SpringBootMain.class,args);
        }
    }
    SpringBootServletInitializer 의 하위 클래스 를 만 들 고 configure 방법 에 있 는 고정 적 인 쓰기 방법 을 사용 해 야 합 니 다.
    
    public class ServletInitializer extends SpringBootServletInitializer {
        @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            //  SpringBoot    ,
            return application.sources(SpringBootMain.class);
        }
    }
    그리고 tomcat 를 시작 하면 콘 솔 에서 spring 을 출력 하면 시작 합 니 다.

    아이디어 설정 springboot 사용 외 장 tomcat 에 대한 자세 한 절 차 를 소개 합 니 다.더 많은 아이디어 설정 springboot 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 많은 응원 바 랍 니 다!

    좋은 웹페이지 즐겨찾기