springboot 二 web綜合開發

2021-08-19 23:36:37 字數 468 閱讀 9096

配置spring controller掃瞄

對接的方法新增@responsebody

新增@configuration註解,將自定義filter加入過濾鏈

com.neo.description=分享生活和技術

create-drop :每次載入hibernate時根據model類生成表,但是sessionfactory一關閉,表就自動刪除。

update:最常用的屬性,第一次載入hibernate時根據model類會自動建立起錶的結構(前提是先建立好資料庫),以後載入hibernate時根據 model類自動更新表結構,即使表結構改變了但表中的行仍然存在不會刪除以前的行。要注意的是當部署到伺服器後,表結構是不會被馬上建立起來的,是要等 應用第一次執行起來後才會。

validate :每次載入hibernate時,驗證建立資料庫表結構,只會和資料庫中的表進行比較,不會建立新錶,但是會插入新值。

Spring Boot 入門之web基礎篇(二)

spring boot 入門之 web 篇 二 由於 jsp 不被 springboot 推薦使用,所以模板引擎主要介紹 freemarker 和 thymeleaf。2.1.1 新增 freemarker 依賴 2.1.2 新增 freemarker 模板配置 2.1.3 freemarker 案...

springboot(二) 在Web中開發應用

springboot中靜態資源訪問 在開發web應用的時候,需要引用大量的js css 等靜態資源。spring boot預設提供靜態資源目錄位置需置於classpath下,目錄名需符合如下規則 static public resources meta inf resources 啟動程式後訪問路徑...

springboot 渲染web頁面

spring boot提供了預設配置的模板引擎主要有以下幾種 注意 避免使用jsp,jsp無法實現spring boot的多種特性 org.springframework.bootgroupid spring boot starter webartifactid dependency org.spr...