SprigBoot學習筆記 尚矽谷(1)

2021-09-29 12:19:49 字數 944 閱讀 7462

1、父專案

2、啟動器

/**

* * **/

public

class

}

@target()

@retention

(retentionpolicy.

runtime

)@documented

@inherited

@springbootconfiguration

@enableautoconfiguration

@componentscan

( excludefilters =

), @filter

( type = filtertype.

custom

, classes =)}

)public @inte***ce

)public @inte***ce

enableautoconfiguration

)//spring的底層註解@import,給容器匯入乙個元件;

@import();

給容器中匯入元件

enableautoconfigurationimportselector:匯入哪些元件的選擇器;

將所有 需要匯入的元件一全類名的方式返回;這些元件就會被新增到容器中;

會給容器匯入很多的自動配置類(***autoconfiguration);就是給容器中匯入這個場景需要的所有元件,並配置號這些元件;

有了自動配置類,免去了我們手動編寫配置注入功能元件等工作;

ide都支援使用spring的專案建立嚮導快速建立乙個spring boot專案;

選擇我們需要的模組;嚮導會聯網建立

乙個spring boot專案;

預設生成的spring boot專案;

MySQL 尚矽谷 學習筆記1

使用資料庫 use myemployees 1.查詢表中的單個字段 select last name from employees 2.查詢表中的多個字段 select last name,salary,email from employees 3.查詢表中的所有字段 方式1 select empl...

MySQL 尚矽谷 學習筆記1

使用資料庫 use myemployees 1.查詢表中的單個字段 select last name from employees 2.查詢表中的多個字段 select last name,salary,email from employees 3.查詢表中的所有字段 方式1 select empl...

尚矽谷學習筆記 宣告式驗證

由於前端的驗證可能會被繞過或無效,所以在伺服器端必須對提交的資料進行驗證,struts2提供了非常便利的驗證器。通過宣告配置就可以達到伺服器端的驗證。struts2 預設的 棧中提供了乙個 validation 這個 將配置的驗證規則和系統具體的乙個驗證器對應,而實際上驗證的是那個驗證器.該檔案位於...