一天完成一個(gè) bbs
本來(lái)想用 kotlin 的 kotr, 要用 gradle,學(xué)習(xí)曲線還是挺難的,還是實(shí)際一點(diǎn),用數(shù)據(jù)的技術(shù)快速搞定吧
創(chuàng)建項(xiàng)目

圖片
下載前端模板
https://www.layui.com/template/fly/
IDEA 打開(kāi)項(xiàng)目
拷貝資源文件

圖片
配置數(shù)據(jù)庫(kù)
spring.datasource.url=jdbc:mysql://localhost:3306/kbbs
spring.datasource.username=root
spring.datasource.password=123qwe
# update 模式會(huì)自動(dòng)建表,有改動(dòng)后也會(huì)更新,不過(guò)不會(huì)刪原來(lái)的東西
spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.connection.release_mode=auto
編寫(xiě)測(cè)試類(lèi)
@Controller
class IndexController {
@GetMapping("/")
fun index() = "index"
}
啟動(dòng)訪問(wèn)
默認(rèn)加了 Security 依賴(lài),訪問(wèn)的時(shí)候有密碼,在啟動(dòng)的控制臺(tái)中可以找到

圖片
OK
但是這個(gè)時(shí)候資源文件都是不對(duì)的
改一下資源文件就顯示正常了

圖片