請(qǐng)輸入標(biāo)題
#初始項(xiàng)目下載地址
https://start.spring.io/

點(diǎn)擊 GENERATE CTRL+
#下載之后拖入到idea
然后將pom.xml文件中的dependencies 和 build全部刪除替換為
<dependencies>
? ? ? ? <dependency><!--web連接-->
? ? ? ? ? ? <groupId>org.springframework.boot</groupId>
? ? ? ? ? ? <artifactId>spring-boot-starter-web</artifactId>
? ? ? ? </dependency>
? ? ? ? <dependency><!--連接MySQL-->
? ? ? ? ? ? <groupId>mysql</groupId>
? ? ? ? ? ? <artifactId>mysql-connector-java</artifactId>
? ? ? ? ? ? <scope>runtime</scope>
? ? ? ? </dependency>
? ? ? ? <dependency><!--注解工具 get set-->
? ? ? ? ? ? <groupId>org.projectlombok</groupId>
? ? ? ? ? ? <artifactId>lombok</artifactId>
? ? ? ? ? ? <optional>true</optional>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>com.baomidou</groupId>
? ? ? ? ? ? <artifactId>mybatis-plus</artifactId>
? ? ? ? ? ? <version>2.3</version>
? ? ? ? </dependency>
? ? ? ? <!--fastJson-->
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>com.alibaba</groupId>
? ? ? ? ? ? <artifactId>fastjson</artifactId>
? ? ? ? ? ? <version>1.2.12</version>
? ? ? ? </dependency>
? ? ? ? <!--druid-->
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>com.alibaba</groupId>
? ? ? ? ? ? <artifactId>druid</artifactId>
? ? ? ? ? ? <version>1.0.18</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>org.mybatis</groupId>
? ? ? ? ? ? <artifactId>mybatis</artifactId>
? ? ? ? ? ? <version>3.4.1</version>
? ? ? ? </dependency>
? ? ? ? <!--thymeleaf? 新的模板引擎,比jsp要出色-->
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>org.springframework.boot</groupId>
? ? ? ? ? ? <artifactId>spring-boot-starter-thymeleaf</artifactId>
? ? ? ? </dependency>
? ? ? ? <!--jdbc-->
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>org.springframework.boot</groupId>
? ? ? ? ? ? <artifactId>spring-boot-starter-jdbc</artifactId>
? ? ? ? </dependency>
? ? ? ? <!-- 分頁插件 -->
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>com.github.pagehelper</groupId>
? ? ? ? ? ? <artifactId>pagehelper-spring-boot-starter</artifactId>
? ? ? ? ? ? <version>1.2.3</version>
? ? ? ? </dependency>
? ? </dependencies>
? ? <build>
? ? ? ? <!-- 配置將哪些資源文件(靜態(tài)文件/模板文件/mapper文件)加載到tomcat輸出目錄里 -->
? ? ? ? <resources>
? ? ? ? ? ? <resource>
? ? ? ? ? ? ? ? <directory>src/main/java</directory><!--java文件的路徑-->
? ? ? ? ? ? ? ? <includes>
? ? ? ? ? ? ? ? ? ? <include>**/*.*</include>
? ? ? ? ? ? ? ? </includes>
? ? ? ? ? ? ? ? <!-- <filtering>false</filtering>-->
? ? ? ? ? ? </resource>
? ? ? ? ? ? <resource>
? ? ? ? ? ? ? ? <directory>src/main/resources</directory><!--資源文件的路徑-->
? ? ? ? ? ? ? ? <includes>
? ? ? ? ? ? ? ? ? ? <include>**/*.*</include>
? ? ? ? ? ? ? ? </includes>
? ? ? ? ? ? ? ? <!-- <filtering>false</filtering>-->
? ? ? ? ? ? </resource>
? ? ? ? </resources>
? ? ? ? <plugins>
? ? ? ? ? ? <plugin>
? ? ? ? ? ? ? ? <groupId>org.springframework.boot</groupId>
? ? ? ? ? ? ? ? <artifactId>spring-boot-maven-plugin</artifactId>
? ? ? ? ? ? </plugin>
? ? ? ? </plugins>
? ? </build>
#配置文件 修改對(duì)應(yīng)的MySQL地址,庫,賬號(hào),密碼
#端口
server.port=8080
#MySQL?
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#MySQL
spring.datasource.url=jdbc:mysql://121.43.224.31:3306/test
spring.datasource.username=root
spring.datasource.password=123456
#thymelea
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.cache=false
#jpa默認(rèn)配置
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jackson.serialization.indent-output=true
spring.jpa.database=mysql
spring.main.allow-bean-definition-overriding=true
原文鏈接:https://blog.csdn.net/qq_45915135/article/details/120873042