日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

pom添加mysql依赖tomcat崩溃_Spring Boot + Mybatis + Spring MVC环境配置(一) :Spring Boot初始化,依赖添加...

發布時間:2023/12/10 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pom添加mysql依赖tomcat崩溃_Spring Boot + Mybatis + Spring MVC环境配置(一) :Spring Boot初始化,依赖添加... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

最近在搭建一個Spring Boot + Mybatis + Spring MVC的環境,折騰來折騰去,兩三天才搞定,記錄下大概過程和遇到的錯誤

看一下Spring Boot官方的介紹

Spring Boot讓開發者省去了大多數Spring的配置,讓其只需要關注主要的開發和進行少量的Spring配置。

嵌入了Tomcat,已定義好大多數的依賴關系,簡化了項目的構建配置。我們在使用的時候不用關心框架之間的兼容性,適用版本等問題,想使用的東西,僅僅添加一個配置就可以了,所以使用spring boot非常適合構建微服務。

第一步,訪問

生成一個spring boot項目

生成之后會下載一個壓縮包,解壓后,在Eclipse中Import為Maven項目

第二步,添加額外需要的依賴,如Mybatis

pom.xml內容如下:

xmlns:xsi="

xsi:schemaLocation="

4.0.0

com.kai

demo

0.0.1-SNAPSHOT

jar

demo

Demo?project?for?Spring?Boot

org.springframework.boot

spring-boot-starter-parent

2.0.4.RELEASE

UTF-8

UTF-8

1.8

org.springframework.boot

spring-boot-starter

org.springframework.boot

spring-boot-starter-test

test

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-devtools

true

mysql

mysql-connector-java

org.mybatis

mybatis

3.4.6

org.mybatis

mybatis-spring

1.3.2

org.apache.logging.log4j

log4j

2.11.1

pom

org.springframework

spring-jdbc

com.zaxxer

HikariCP

3.2.0

org.springframework.boot

spring-boot-maven-plugin

true

引入web模塊

Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container

org.springframework.boot

spring-boot-starter-web

pom.xml文件中默認有兩個模塊:

spring-boot-starter:核心模塊,包括自動配置支持、日志和YAML;

spring-boot-starter-test:測試模塊,包括JUnit、Hamcrest、Mockito。

開發環境的調試

熱啟動在正常開發項目中已經很常見了吧,雖然平時開發web項目過程中,改動項目啟重啟總是報錯;但springBoot對調試支持很好,修改之后可以實時生效,需要添加以下的配置:

org.springframework.boot

spring-boot-devtools

true

org.springframework.boot

spring-boot-maven-plugin

true

完整環境下載地址:

總結

以上是生活随笔為你收集整理的pom添加mysql依赖tomcat崩溃_Spring Boot + Mybatis + Spring MVC环境配置(一) :Spring Boot初始化,依赖添加...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。