總結分析:idea基本設定裡propeties files(*.properties)語言為gbk,應該改為utf-8。
解決方案:在file-settings-editor-file encodings-修改de****t encoding for properties files 為utf-8,且勾上transparent native-to-ascii conversion
解決方案:
1.新增如下**,解決衝突
2.新增資料庫相關參量
spring.datasource.driver-class-name=com.mysql.cj.jdbc.driver
spring.datasource.url=jdbc:mysql://localhost:3306/springboot_itcast?servertimezone=gmt
spring.datasource.username=root
spring.datasource.password=123456
分析:這裡就是springboot最大的坑點,用相對路徑時候會發生這樣的報錯,因為它太貼心了,已經幫我們預設了在static的靜態路徑。
解決方案:
1.刪除前面/static再加上自己的專案path,即可,如下
server.servlet.context-path=/test
2.推薦使用
在配置中新增靜態訪問路徑
spring.mvc.static-path-pattern=/static/**
按鈕
相關hello
@controller
public class ajaxcontroller
}
分析:這裡犯了個低階錯誤,就是@controller標籤,@restcontoller標籤區別。
簡單來說就是@restcontoller=@controller+@responsebody
解決方案:
1.把@controller改為@restcontroller
2.新增@responsebody標籤
@controller
public class ajaxcontroller
}
本次內容為springboot初次學習過程中遇到的一些問題,僅僅是錯題集,供後來學習者參考。 SpringBoot的idea搭建使用過程
開啟idea,選單選擇file new project spring initialize name 專案的名稱 location 存放專案的路徑 type 選擇m en group 組名artifact 包名project sdk jdk的版本 j a 具體的版本,兩個版本需要對應 點選next後...
Spring Boot中如何使用過濾器
1,定義過濾器和設定呼叫順序 假設定義兩個過濾器 1,事物過濾器 開啟和提交事物操作 2,請求響應日誌過濾器 記錄請求和響應日誌和原始過濾器一樣,我們需要實現filter介面 component order 1 public class transactionfilter implements fi...
關於一些已使用過的外掛程式
less 有段時間在折騰less,但是less如果不引入相關的js,或者在伺服器端有相應的配置是需要編譯的,然後試了幾個編譯less的外掛程式,最終感覺最好用的當屬winless,首先他能夠自動監控 的變化然後及時編譯生成css這一點就足以讓我開心了,其次還有支援壓縮等額外的功能,只是他不支援編寫,...