## Spring Framework的發展和Spring Boot
* Spring 3 支持Java注解
* Spring 4 支持 Java 8, 同時推出Spring Boot
Spring Boot 簡化了Spring配置。
## Spring Boot是什么?
Boot 翻譯有靴子,啟動的意思, 在計算機領域有引導的意思, 比如計算機啟動引導或是Linux 的引導程序。
Spring Boot就是Spring的快速引導, 也就是引導快速搭建Spring 框架。
早期的Spring項目基于XML文件進行配置, 類似Bean,數據源等都在XML中配置, 配置繁瑣,初始化一個項目需要耗費較長時間, 后來Java的注解使用逐漸增多, 很多配置就可以從XML轉到Java類本身了。
在此繼承上, Spring Boot簡化配置, 很容易就可以創建一個項目, 大大減少了項目初始化的時間。
** Spring Boot 不是一個全新的框架, 其是Spring的一種簡化配置方式。**
## Spring Boot版本
2014 年首次發布。
* 版本歷史 https://github.com/spring-projects/spring-boot/releases

* 項目源碼 https://github.com/spring-projects/spring-boot

* 示例 https://github.com/netgloo/spring-boot-samples
## Spring Boot的特性:
Spring Boot的特性包括:
* 快速創建獨立的Spring應用
* 內嵌了Tomcat , Jetty 等應用服務器, Web類型的項目不需要單獨的部署就可以運行
* 提供了默認的初始化依賴
* 根據需要自動配置第三方依賴庫
* 提供了現成可用的應用健康檢查,測量以及外部配置
* 完全不需要代碼生成以及XML配置。
* 自動配置(Auto Configuration): 簡化配置, 比如在classpath 發現了Spring Security 的包, 則自動創建相關的Bean
* 啟動器(Starters)
* CLI Comand-line interface 支持groovy 開發。
* Actuator : 查看運行參數、線程、GC等
## Spring Boot 項目創建與運行
Spring 官方提供了在線的項目生成器,可以很便捷的生成項目, 生成器的地址是https://start.spring.io/,除此之外, 也可以直接在IDE中創建Maven等類型的項目。 關于項目的創建和運行,可以參考:
[如何創建Spring Boot項目](https://blog.csdn.net/oscar999/article/details/101008543)
## Spring Boot 之約定優于配置
在Spring Boot中, 約定優于配置是一個入門需要了解的概念, 簡單點理解就是默認配置。 大家遵循一定的契約。
### 約定優于配置之前
在Spring Boot之前, Spring + Spring MVC 開發Web需要配置很多的配置, 包括:
* 導入Web開發的很多jar (雖然可以依賴導入, 但還是要導入很多個)
* 在application-web.xml 配置視圖解析器,類似
```
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
```
* 在application.xml 中配置數據源, 事務等。
### Spring Boot 的配置
在Spring Boot中只需要導入 `spring-boot-starter-web`, 一切都默認配置好, 而且還內置一個Tomcat服務,是不是方便很多。
PS. 如果需要,可以對默認配置進行修改。
*****
*****
## 學習思維
* REST
* YAML 和Java Config
- 前言
- 1. 基礎篇
- Spring Boot 介紹
- 如何創建Spring Boot項目
- Spring Boot基本使用
- 1. 系統構建
- 2. 代碼結構和開發
- 項目配置
- 配置文件
- pom.xml 配置說明
- 測試
- 測試介紹
- 測試注解
- 常見問題及解決
- Spring Boot測試示例
- Spring Boot Test 進行JPA 測試保存數據到數據庫
- 常見開發類
- Web
- HttpEntity
- CommandLineRunner
- 開發IDE
- Eclipse開發設置
- 開發知識點
- 項目相關路徑與資源獲取
- 2. 數據篇
- Spring操作數據庫的方式匯總
- Spring Data JPA
- Spring Boot操作數據庫的方式
- Spring Boot+JPA CriteriaBuilder查詢
- Spring Boot+JPA 有查詢條件的查詢
- CriteriaBuilder轉sql語句
- DAO
- Spring Boot+JPA 查詢數據方式與代碼演示
- Spring JPA 接口和類
- CrudRepository
- JPA Native Query(原生查詢)的緩存問題
- Eclipse下安裝EclipseLink進行JPA開發
- Eclipse Link or Hibernate
- 配置參考
- Spring Boot多數據源配置
- 錯誤解決
- ORA-00932: inconsistent datatypes: expected - got CLOB
- hibernate in 的list 大小不能超過1000
- java.lang.IllegalArgumentException: Cannot create TypedQuery for query with more than one return using requested result type
- ava.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate class [XXX]
- JPA 基礎
- Spring Jdbc 實現 Clob/Blob 類型字段的插入
- JPA Native Query(本地查詢)及查詢結果轉換
- JPA如何查詢部分字段
- JPA 主鍵策略
- JPA+EclipseLink+Oralce 通過GenerationType.AUTO 實現自增長字段
- JPA的persist() 和 merge() 方法的區別
- 關聯
- 批量更新
- JPA重要知識點
- JPA中實體的狀態
- 數據庫操作技術
- JPA二級緩存
- JPA3
- 分頁查詢
- Spring Boot+JPA 事務
- Spring Boot 數據源
- Spring Boot 3 整合 H2 快速示例
- Spring Boot+JPA+Oralce 配置
- Spring Boot+JPA不同類型數據庫的多數據源配置
- Spring Data JPA + Oracle
- Spring Boot + Oracle 處理Blob/Clob類型字段實例
- Spring Boot+JPA+Oracle Clob 類型字段查詢處理
- Spring Boot + JPA + Oracle 自增長字段實現示例
- 內存數據庫H2+Spring Boot
- 3. 實戰篇
- 項目創建和管理
- 基于Maven創建多模塊的Spring Boot項目
- 最佳實踐
- REST —Java對象的字符串屬性值轉換為JSON對象的布爾類型值
- Spring Boot 項目中Java對象的字符串類型屬性值轉換為JSON對象的布爾類型鍵值的解決方法及過程
- [在線API]Spring Boot+springfox-swagger2 之RESTful API自動生成和測試
- Spring Boot與JWT整合實現前后端分離的用戶認證之一
- 前后端分離的用戶驗證原理及Spring Boot + JWT的框架搭建(附完整的框架代碼)之一
- 前后端分離的用戶驗證原理及Spring Boot + JWT的框架搭建(附完整的框架代碼)之二
- SpringBoot應用中JSP的角色及整合
- Spring Boot項目中使用JSP實例
- Spring Boot 文件上傳功能實現與簡單示例
- Spring Boot+CKEditor 實現編輯器中的圖片上傳
- 開發注意事項
- 部署與維護
- SpringBoot項目在Gitee的控管步驟
- JSP如何獲取Spring Boot的配置屬性
- 錯誤頁面處理
- JPA相關
- Spring Boot + JPA 表和類的對應處理
- Spring Boot + JPA +MySQL 數據操作及示例環境搭建(手動建表)
- Spring Boot + JPA +MySQL 數據操作及示例環境搭建(自動建表)
- 基于Spring Boot + JPA +MySQL的JPA關聯查詢ManyToOne示例
- JPA的單向一對多關聯(oneToMany)實現示例(基于Spring Boot + JPA +MySQL,表自動維護)
- JPA的雙向一對多關聯(oneToMany)實現示例(基于Spring Boot + JPA +MySQL,表自動維護)
- JPA的雙向一對一關聯實現示例(基于Spring Boot + JPA +MySQL,表自動維護)
- 一次使用JUnit + JPA 實現數據Migrate的實例介紹
- Spring Boot整合H2內存數據庫配置及常見問題處理
- Spring Boot + Spring Data JPA 實現數據庫操作的標準示例
- REST
- Spring Boot 訪問HTTPS的url
- Spring Boot集成Log4j2
- Spring Boot + Ext JS 安全
- Spring Boot Web
- 內置服務器
- Spring Boot 中Filter的定義方式
- 開發工具
- Spring 開發利器之——Spring Tools 4
- Spring OAuth2+Basic
- Spring 緩存
- 快速實例
- Spring Security實戰
- Spring Boot OAuth2 快速入門示例
- Spring Boot 項目使用Spring Security防護CSRF攻擊實戰
- Spring Boot OAuth2 認證服務器搭建及授權碼認證演示
- 基于Spring OAuth2 之客戶端憑證模式演示
- 基于Spring OAuth2 之簡化模式演示
- 密碼模式
- 客戶端憑證
- 設置JWT Claim
- Client 數據庫配置
- Spring Boot+Security 實現Basic認證
- Spring Boot + WebLogic 12c 之Basic認證
- spring-security-oauth2-authorization-server
- 4. 專題篇
- 項目與屬性配置
- 外部化程序的配置
- 服務配置
- 不使用spring-boot-starter-parent作為Parent
- 數據庫配置
- Spring Boot 2.7.14+Oracle 11+WebLogic
- Spring Boot+Vaadin
- Spring Boot+Vaadin 14項目初始化
- Vaadin 導入JS和添加JS代碼段
- 常見及疑難問題解決
- Could not find artifact org.vaadin.artur:a-vaadin-helper:jar:1.6.2
- Spring Boot+Activiti
- Spring Boot + Activiti 工作流框架搭建
- Activiti 知識
- Spring Boot+Activiti開發注意點
- Activiti 代碼
- Spring Boot緩存
- Spring Boot Cache
- Spring Boot整合Redis快速入門實例
- 配置 JSON 序列器
- 錯誤解決篇
- Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
- Spring Root+Cache+Redis 實戰
- Spring Boot+Redis 實現分布式緩存
- Spring Cloud + Redis 配置
- 主要類和方法
- 使用方式
- 緩存配置
- Redis Cache
- 緩存注解
- 類配置
- Spring Cloud
- 微服務架構
- 快速了解Spring Cloud
- Spring Cloud Eureka 最簡入門示例
- Spring Cloud Ribbon 負載均衡客戶端調用示例
- Spring Cloud Eureka注冊服務器集群配置
- Spring Cloud常見問題及解決
- Spring Cloud Eureka Server的部署與啟動
- 配置中心
- Spring Boot+HATEOAS
- HATEOAS概念
- Spring Boot+HATEOAS快速介紹與示例
- 開發說明
- Spring 安全
- Spring 框架RCE 安全漏洞
- Spring RCE 漏洞 CVE-2022-22965 的終極解決方案
- Spring Boot 跨域訪問實現方式
- 輕量級網關-反向代理
- Spring Security
- 基本使用
- 主要問題
- securityChain
- UserDetailsService
- 忽略請求URL
- 安全
- Spring Boot項目CSRF (跨站請求偽造)攻擊演示與防御
- Spring Boot CSRF 防御+Coverity
- 認證管理器-AuthenticationManager
- Spring Security開發介紹
- Spring Security 快速入門
- Spring Security 依賴導入
- Spring Security 用戶認證
- Spring CSRF 實現機制
- 實戰示例
- 入門示例
- Spring Security 常見問題
- Caused by: java.lang.IllegalArgumentException: realmName must be specified
- 總是報403錯誤
- Spring訪問http/https
- Spring RestTemplate 訪問https站點
- Spring Boot RestTemplate 忽略證書訪問https
- Spring Boot OAuth2 Client -客戶端模式 client credentials 獲取token
- OAuth2RestTemplate
- Spring Security OAuth 訪問OAuth2.0 的https站點
- Spring RestTemplate 忽略證書訪問https的OAuth2 認證站點
- Spring OAuth 2.0
- 授權服務器和資源服務器
- Spring 對 OAuth2.0的解決方案
- OAuth2 認證服務器
- jjwt+oauth
- Spring OAuth2 的認證
- Spring Boot實現訪問接口的Basic認證
- CORS
- Access-Control-Allow-Credentials
- Java JWT
- JWT
- 聲明-subject
- 安全基本知識
- BCrypt
- Spring LDAP
- Spring Boot LDAP 認證
- LDAP問題與解決
- javax.naming.PartialResultException: Unprocessed Continuation Reference(s);
- Spring IO
- 接口和類
- Resource
- 性能
- Web緩存
- Spring Web
- 如何添加Filter
- OncePerRequestFilter
- 得到請求地址和參數
- 應用上下文路徑
- 5. 開發參考
- 注解
- WebMvcAutoConfiguration
- JPA
- 如何加載 jar 中的注解類
- 1
- @EnableAsync
- 6. 常見問題
- bean named 'entityManagerFactory' that could not be found錯誤及解決
- invalid LOC header錯誤及解決
- No identifier specified for entity:
- Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
- Could not resolve view with name 'xxxx' in servlet with name 'dispatcherServlet'
- JSON parse error: Unrecognized field
- multipart/form-data;boundary=----WebKitFormBoundaryRAYPKeHKTYSNdzc1;charset=UTF-8' not supported
- 跨域 Access to XMLHttpRequest at ' xxxxx' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- maven 下載問題
- Maven 無法下載Oracle 驅動解決
- Spring Boot常見面試題
- Spring Boot 訪問JSP主頁面出現下載頁面
- Spring Boot 面試題大全
- Spring Cloud相關問題
- java.lang.IllegalStateException: Request URI does not contain a valid hostname: http://eurekaclient_service/
- Spring JPA
- Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set。
- 同時排序和分頁查詢的數據不對
- No EntityManager with actual transaction available for current thread
- should be mapped with insert="false" update="false"
- java.lang.IllegalArgumentException: Not a managed type:XX
- java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: XX is not mapped
- org.springframework.transaction.UnexpectedRollbackException: Transaction silently rolled back because it has been marked as rollback-only
- Transaction rolled back because it has been marked as rollback-only
- org.hibernate.LazyInitializationException: could not initialize proxy xxx - no Session
- [EclipseLink]The attribute [xxx] of class [xxx] is mapped to a primary key column in the database. Updates are not allowed.
- cannot simultaneously fetch multiple bags
- Spring Boot + Hibernate java.lang.IllegalArgumentException: Not an entity: class
- mvn spring-boot class file for javax.interceptor.InterceptorBinding not found
- sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- Spring Boot返回的數據格式是XML 而不是JSON之原因探求的和解決
- Failed to parse multipart servlet request; nested exception is javax.servlet.ServletException: The request content-type is not a multipart/form-data
- WebSecurityConfigurerAdapter 過時及替代寫法
- consider increasing the maximum size of the cache
- java.lang.ClassCastException: org.springframework.context.annotation.AnnotationConfigApplicationContext cannot be cast to org.springframework.web.context.WebApplicationContext
- org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet
- Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet
- Spring Boot測試無法運行問題解決(注入的組件為空)
- web.xml is missing and <failOnMissingWebXml> is set to true
- no main manifest attribute
- Refused to display 'http://localhost:8080/' in a frame because it set 'X-Frame-Options' to 'deny'.
- 問題模板
- Spring Security問題
- WebSecurityConfigurerAdapter過期了
- @EnableAuthorizationServer 已經廢棄
- com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve subtype of [map type; class java.util.Map, [simple type, class java.lang.String] -> [simple type, class java.lang.Object]]: missing type id property '@class'
- Spring Web問題
- I/O error while reading input message; nested exception is java.io.IOException: Stream closed
- Filter讀取JSON參數之后, Spring無法自動封裝
- 部署到 WebLogic的問題
- 如何導入其他jar 的組件
- 類型轉換
- JSON 格式轉換
- Spring開發問題之org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class
- 7. 官方文檔翻譯篇
- Spring Framework參考文檔-V6.0.8
- 總覽
- 核心
- 測試-
- 數據訪問
- Web Servlet
- Web Reactive
- 整合
- 1. REST 客戶端
- 2.JMS(Java消息服務)
- 3. JMX
- 4. 郵件
- 5. 任務執行與排程
- 6. 緩存抽象
- 7. 監控支持
- 語言
- Spring Boot核心功能
- 1. SpringApplication 啟動引導類
- 2. 屬性配置
- 2.8 類型安全的屬性配置
- 3. Profile
- 4. 日志
- 5. 國際化
- 6. JSON
- 7. 任務執行和計劃
- 8. 測試
- 8.1 測試范圍依賴
- 8.2 測試Spring應用
- 8.3 測試Spring Boot應用
- 8.3.1 偵測Web應用的類型
- 8.3.2 偵測測試配置
- 8.3.3 排除測試配置
- 8.3.4 使用應用的參數
- 8.3.5 使用模擬環境測試
- 8.3.6 使用服務器進行測試
- 8.3.7 自定義WebTestClient
- 8.3.8 使用JMX
- 8.3.9 使用Metrics
- 8.3.10 模擬和窺探Beans
- 8.3.11 自動配置的測試
- 8.3.12 自動配置的JSON測試
- 8.3.13 Spring MVC測試的自動配置
- 8.3.14 Spring WebFlux 測試的自動配置
- 8.3.15 Cassandra 測試的自動配置
- 8.3.16 數據 JPA 測試的自動配置
- 8.4 測試工具類
- 9. 定制屬于你的自動配置
- 9.1 了解自動配置的Beans
- 9.2 定位自動配置的候選者
- 9.3 條件注釋
- 10. Kotlin 支持
- Spring Boot 其他功能
- 7. Web 應用的開發
- Spring MVC 框架
- Spring WebFlux 框架
- JAX-RS 和Jersey
- 內置 Servlet 容器支持
- 內置響應式服務器支持
- 響應式服務器資源配置
- 8. 優雅關閉
- 9. RSocket
- 10. 安全
- 11. 使用SQL 數據庫
- 11.2 JdbcTemplate 的使用
- 12. NoSQL技術
- 13. 緩存
- 14. 消息
- 15. 使用RestTemplate調用REST服務
- 16. 使用WebClient調用REST服務
- 17. 驗證
- 18. 發送郵件
- 19. 使用JTA實現分布式事務
- 20. 分布式內存-Hazelcast
- 21. 定時器Quartz Scheduler
- 22. 任務執行和計劃
- 23. Spring 整合
- 24. Spring 會話
- 25. 使用JMX 監控和管理
- 26. Testing 測試
- 27. WebSockets
- 28. Web Services
- 29. 創建自動配置
- 30. 對Kotlin 的支持
- 31. 容器
- Spring Boot開發指南 V3.1
- 入門
- Spring Boot應用升級
- 如何使用Spring Boot進行開發
- 核心功能
- Web-
- Data-數據
- IO
- 緩存
- 消息
- 容器
- 生產就緒功能
- 部署
- GraalVM Native Image Support
- Spring Boot命令行
- 構建工具插件
- 1. Spring Boot 應用
- 1.1 自定義錯誤分析器
- 1.2 自動配置的故障排除
- 1.3 啟動之前自定義環境(Environment)和應用上下文(ApplicationContext)
- Spring Data Redis -Version 3.0.5
- 前言
- Spring Redis 開發參考文檔
- 響應式 Redis 支持
- Redis集群
- Redis存儲庫
- Spring Security
- 參考
- Spring Authorization Server-0.4.2
- 概括
- 幫助
- Spring認證服務入門
- Spring Authorization Server-0.4.3
- 協議端點(Protocol Endpoints)
- OAuth2 授權端點
- 核心模型組件
- OAuth2TokenCustomizer
- 關聯知識
- JWK Set
- 默認端點
- JWT JWK
- OpenID Connect 1.0
- OAuth2
- 問題
- [invalid_request] OAuth 2.0 Parameter: redirect_uri
- [invalid_request] OAuth 2.0 Parameter: state
- There is no PasswordEncoder mapped for the id "null"
- 實際開發
- 8. 補充篇
- Jackson
- 資源
- 配置大全
- Spring Boot 與 Java 版本對應
- Java Web
- 如何在Filter中讀取JSON 類型的參數