動(dòng)力節(jié)點(diǎn)王鶴最新SpringBoot3第八章筆記
創(chuàng)建新的Spring Boot項(xiàng)目妒蛇,綜合運(yùn)用視頻中的知識(shí)點(diǎn)幌氮,做一個(gè)文章管理的后臺(tái)應(yīng)用。 新的Spring Boot項(xiàng)目Lession20-BlogAdmin逼肯。Maven構(gòu)建工具,包名稱com.bjpowernode.blog JDK19膜钓,依賴:
[if !supportLists]·?[endif]Spring Web
[if !supportLists]·?[endif]Lombok
[if !supportLists]·?[endif]Thymeleaf
[if !supportLists]·?[endif]MyBatis Framework
[if !supportLists]·?[endif]MySQL Driver
依賴還需要Bean Validation
需求:文章管理工作,發(fā)布新文章卿嘲,編輯文章颂斜,查看文章內(nèi)容等
step1:組織配置文件[MISSING IMAGE: , ?]
app-base.yml
| article: _#最低文章閱讀數(shù)量 _low-read: 10 _#首頁顯示最多的文章數(shù)量
_top-read: 20
db.yml
| spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/blog?serverTimezone=Asia/Shanghai username: root password: 123456 hikari: auto-commit: true maximum-pool-size: 10 minimum-idle: 10 _#獲取連接時(shí),檢測(cè)語句 _connection-test-query: select 1 connection-timeout: 20000 _#其他屬性 _data-source-properties: cachePrepStmts: true dataSource.cachePrepStmtst: true dataSource.prepStmtCacheSize: 250 dataSource.prepStmtCacheSqlLimit: 2048 dataSource.useServerPrepStmts: true | | --- |
step2: logo文件 favicon.ico放在static/ 根目錄下
step3:創(chuàng)建模板頁面[MISSING IMAGE: , ?]
articleList.html
|
<form id="delfrm" th:action="@{/article/removeArticle}" method="post">
?<input type="hidden" id="idsDom" name="ids" value="" >
</form>
addArticle.html
step4: java代碼
model包:[MISSING IMAGE: , ?]
ArticleVO.java