springboot結合前端有很多種方法,比如在static裡面直接加入css或js,又或者引入webjars,以jar包的形式加入專案
webjars形式
pom 檔案
<
!-- 引用bootstrap --
>
org.webjars<
/groupid>
bootstrap<
/artifactid>
3.3.7-1
<
/version>
<
/dependency>
<
!-- 引用jquery --
>
org.webjars<
/groupid>
jquery<
/artifactid>
3.1.1
<
/version>
<
/dependency>
然後我們觀察一下專案的依賴jar包,依賴中就有了bootstrap.jar和jquery.jar
然後在src/main/resources/static檔案下新建index.html,**如下:
<
!doctype html>
"en"
>
"utf-8"
>
dalaoyang<
/title>
"stylesheet" href=
"/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css"
/>
"/webjars/jquery/3.1.1/jquery.min.js"
>
<
/script>
"/webjars/bootstrap/3.3.7-1/js/bootstrap.min.js"
>
<
/script>
<
/head>
"container"
>
>
"alert alert-success"
>
"#" class=
"close" data-dismiss=
"alert" aria-label=
"close"
>×<
/a>
hello,
dalaoyang!
<
/strong>
<
/div>
<
/div>
<
/body>
<
/html>
至此配置已經結束,啟動專案,訪問http://localhost:8888/
修改預設靜態資源路徑,方法一:配置spring.resources.static-locations引數
spring.resources.static-locations=classpath:
/myresources/
2-5-修改預設靜態資源路徑,方法二:重寫webmvcconfigureradapter 中的addresourcehandlers方法,自定義對映路徑
2-5-1-重寫webmvcconfigureradapter 中的addresourcehandlers方法,自定義對映路徑
@configuration
public class mywebmvcconfigureradapter extends webmvcconfigureradapter
}
原始碼解析 專題學習 LCT
等下發樹剖的學習筆記 lct link cut tree 是解決一類動態樹問題的資料結構 主要是給乙個有根樹的森林,然後有動態插入邊,刪除邊,詢問等操作 保證時刻是乙個森林 lct維護子樹資訊比較麻煩,這裡暫時不提 一 實邊和虛邊 lct 會將兒子劃分為虛 實兩種兒子,相應的邊稱為虛邊或實邊,且任意...
動態規劃專題學習
一.明確dp陣列的含義 構造一維dp i 二維dp i j 明確其代表了什麼狀態,一般與題目的目的有關。如解決萬用字元問題,就定義boolean dp表示s i 1 與p j 1 的匹配成功與否 解決最長子陣列問題,就定義dp表示a i 1 與b j 1 的最長字尾公共陣列長度 解決最長子序列問題,...
樹鏈剖分 專題,學習記錄
理解了上面的那個部落格中的想法之後,你可以看這個神犇寫的 spoj上的 第一版 調了一下午 半晚上,第一次a的時候那真是excited include include include include include include using namespace std typedef long l...