Springboot:
简单来说,springboot有点类似maven的作用,整合了大量的框架,功能,使用起来非常方便快捷,减少了大量的配置文件
Springboot添加maven基本不需要版本号,它的祖父spring-boot-dependencies 基本上把所有常用模块的都添加进去了
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.3.3.RELEASE</version>
</parent>
<properties>
<activemq.version>5.15.13</activemq.version>
<antlr2.version>2.7.7</antlr2.version>
<appengine-sdk.version>1.9.81</appengine-sdk.version>
<artemis.version>2.12.0</artemis.version>
<aspectj.version>1.9.6</aspectj.version>
<assertj.version>3.16.1</assertj.version>
<atomikos.version>4.0.6</atomikos.version>
<awaitility.version>4.0.3</awaitility.version>
<bitronix.version>2.1.4</bitronix.version>
<build-helper-maven-plugin.version>3.1.0</build-helper-maven-plugin.version>
<byte-buddy.version>1.10.14</byte-buddy.version>
。。。。。。。。
搭建一个简单的Springboot-web项目:
springboot搭建有些基本的要求:
Spring Boot 2.3.0.RELEASE需要Java 8
Maven :3.3+
tomcat : 8.5.x+ Servlet 3.1+
WEB项目和普通项目有点区别,启动类旁边会多个ServletInitializer
1:使用 Spring Initializer快速创建项目;
2:项目下添加web,即main路径下创建webapp及WEB-INF,web.xml
3:修改pom文件,将jar包形式修改为war包,将嵌入式tomcat改为provided
<groupId>com.springboottest</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
4:创建两个简单的页面:
hello.jsp,first.jsp
1.hello.jsp
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2020/9/8 0008
Time: 23:32
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h1> hello.........</h1>
<a href="abc">abc</a>
</body>
</html>
2.first.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>