Spring Boot+JPA+Mysql+ThymeLeaf快速構建CURD系統(一)Spring Boot介紹

說起搭建WEB服務,以前用的是SSH,構建一個WAR包後扔給容器,裏面各種XML配置文件。對於長期項目來說,初始時這麼搞一下倒不是什麼問題,但有時候比如只需要做一個內部工具,業務邏輯非常簡單,如果再這麼去搞一套,可能搭建這套東西時間遠大於寫業務邏輯的時間。那麼有沒有什麼框架可以簡化這個過程?找了一圈,發現SpringBoot還不錯。

先看看SpringBoot官網介紹:

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”. We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

You can use Spring Boot to create Java applications that can be started using java -jar or more traditional war deployments. We also provide a command line tool that runs “spring scripts”.

Our primary goals are:

Provide a radically faster and widely accessible getting started experience for all Spring development.
Be opinionated out of the box, but get out of the way quickly as requirements start to diverge from the defaults.
Provide a range of non-functional features that are common to large classes of projects (e.g. embedded servers, security, metrics, health checks, externalized configuration).
Absolutely no code generation and no requirement for XML configuration.

翻譯過來,大概意思是:

Spring Boot 讓你更容易的構建單獨的,基於Spring的,產品級的,可以直接run的應用。我們已經固話了很多配置。大部分Spring Boot的應用只需要很少的配置。

你能夠創建一個Java應用,這個應用可是使用 java -jar來啓動異或者使用傳統的war包部署方式。我們也提供一個命令行工具來運行“spring scripts”。

我們的主要目標有:

爲所有的Spring開發提供一個快速以及容易理解的快速構建方法
通過默認配置快速構建。
提供廣泛的非業務特性,這些特性對很多項目都適用(比如:嵌入式服務,安全,度量, 健康檢查,外部配置等)。
沒有代碼自動生成以及XML配置的需求。

聽着還是很不錯的對不,下面我就動手開發一個最基本的CURD系統,並讓其正確工作,以此來摸清Spring Boot的使用和特點。該系統實現一個簡單通信錄,可以實現增加/刪除/修改/查詢(CURD)聯繫人,後臺數據庫採用Mysql,前端使用ThemeLeaf技術,DAO層使用 Spring JPA和Hibernate的組合。

發佈了30 篇原創文章 · 獲贊 4 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章