SpringBoot Web项目

145 阅读1分钟

创建SpringBoot项目:

  • 基于官网创建,再导入IDE
  • 创建maven工程,再引入SpringBoot依赖(pom.xml中)
<!--将spingboot作为本项目的夫项目-->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

Springboot内置web服务器,不需要引入

SpringApplication.run(SpringBootApp.class, args);

要引入Web模块

<!--web模块-->
<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
</dependency>

整合jsp

添加jsp依赖

<!--对jsp的支持 -->
<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
</dependency>