新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

idea怎么使用外置tomcat配置springboot-创新互联

本篇内容介绍了“idea怎么使用外置tomcat配置springboot”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站设计、成都网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的蕉城网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!
  •  创建一个maven项目

  • 导入springboot依赖,注意底下注释部分



    4.0.0

    com.znsd.springboot
    springboot-jsp
    1.0-SNAPSHOT
    
    
    
    war
    
        org.springframework.boot
        spring-boot-starter-parent
        2.3.12.RELEASE
         
    

    
        
            org.springframework.boot
            spring-boot-starter-web
        

        
        
            org.springframework.boot
            spring-boot-starter-tomcat
            
            provided
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
            
                
                    org.junit.vintage
                    junit-vintage-engine
                
            
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

完成下图操作保存即可


idea怎么使用外置tomcat配置springboot

配置tomcat启动项

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

配置视图解析器


idea怎么使用外置tomcat配置springboot

创建一个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就启动成功了

idea怎么使用外置tomcat配置springboot

“idea怎么使用外置tomcat配置springboot”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


分享题目:idea怎么使用外置tomcat配置springboot-创新互联
转载来源:http://www.wjwzjz.com/article/ddpdgi.html
在线咨询
服务热线
服务热线:028-86922220
TOP