IDEA建的SpringBoot项目配置webapp以及web.xml

时间:2024-03-14 08:11:46

IDEA建的SpringBoot项目配置webapp以及web.xml

 

IDEA新建的项目,默认是没有webapp和web.xml的。

 

我们下面来讲下,如何配置出来;

打开项目结构 project Structure

IDEA建的SpringBoot项目配置webapp以及web.xml

 

选择Modules 项目下面会有一个web

IDEA建的SpringBoot项目配置webapp以及web.xml

 

假如没有 可以添加

IDEA建的SpringBoot项目配置webapp以及web.xml

 

点击Web,配置下,上面是部署描述 web.xml,然后右侧可以编辑,也可以删除,重新添加,都行;建议 把WEB-INF\web.xml配置到项目\src\main\webapp\下,是一般开发习惯;

IDEA建的SpringBoot项目配置webapp以及web.xml

 

然后点击OK即可;

 

webapp出来了,包括WEB-INF和web.xml

IDEA建的SpringBoot项目配置webapp以及web.xml

 

测试下;

 

web.xml 修改 ,添加一个默认欢迎页面;

IDEA建的SpringBoot项目配置webapp以及web.xml

 

再新建一个index.html

IDEA建的SpringBoot项目配置webapp以及web.xml

 

启动项目,测试;

IDEA建的SpringBoot项目配置webapp以及web.xml

 

OK