Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

部分 I. Spring Framework

目錄

4. Spring Tool Suite
4.1. 安裝
4.2. Dashboard
5. Spring Boot
5.1. Spring Boot Quick start
5.1.1. pom.xml
5.1.2. Controller
5.2. 運行
5.2.1. Linux systemd
5.2.2. 傳統 init.d 腳本
5.3. application.properties
5.3.1. PID FILE
5.3.2. 內嵌 tomcat server
5.3.2.1. server.tomcat.basedir
5.3.2.2. server
5.3.2.3. tomcat
5.3.2.4. logging
5.3.2.5. charset
5.3.2.6. Session 配置
5.3.2.7. error 路徑
5.3.2.8. 壓縮傳輸
5.3.2.9. server.servlet.context-path
5.3.2.10. ssl
5.3.3. JSON
5.3.4. SMTP 相關配置
5.3.5. Redis
5.3.6. MongoDB
5.3.7. MySQL
5.3.8. Oracle
5.3.9. default_schema
5.3.10. velocity
5.3.11.
5.4. SpringApplication
5.4.1. @SpringBootApplication
5.4.2. @EnableAutoConfiguration
5.4.3. @ComponentScan
5.4.4. CharacterEncodingFilter
5.4.5. 隱藏 Banner
5.4.6. CORS 跨域請求
5.4.7. 實體與倉庫掃瞄
5.4.8. 列出 Beans
5.5. 編譯用於Tomcat的 War
5.6. Properties
5.6.1. Application
5.6.2. spring.profiles.active 參數切換配置檔案
5.7. Service
5.7.1. Application
5.7.2. 定義介面
5.7.3. 實現介面
5.7.4. 調用 Service
5.8. ViewResolver
5.8.1. Maven
5.8.2. application.properties
5.8.3. Application
5.8.4. IndexController
5.8.5. src/main/webapp/WEB-INF/jsp/index.jsp
5.8.6. 整合模板引擎
5.9. Logging
5.9.1. 打印日誌
5.9.2. 日誌輸出級別
5.9.3. 禁止控制台輸出日誌
5.9.4. 日誌分割
5.9.5. 日誌寫入 MongoDB
5.10. Session share
5.10.1. Redis
5.10.1.1. Maven
5.10.1.2. application.properties
5.10.1.3. Application
5.10.2. 測試 Session
5.10.3. JDBC
5.11. Connection and Statement Pooling
5.11.1. org.apache.tomcat.jdbc.pool.DataSource
5.11.2. druid
5.11.3. c3p0 - JDBC3 Connection and Statement Pooling
5.11.4. dbcp2
5.11.5. bonecp
5.11.6. dbcp2
5.12. Spring boot with MongoDB
5.12.1. Maven
5.12.2. Application
5.12.3. MongoTemplate
5.12.4. Repository
5.13. Spring boot with MySQL
5.13.1. Maven
5.13.2. Resource
5.13.3. Application
5.13.4. JdbcTemplate
5.13.5. CrudRepository
5.14. Spring boot with Oracle
5.14.1. Maven
5.14.2. application.properties
5.14.3. Application
5.14.4. CrudRepository
5.14.5. JdbcTemplate
5.14.6. Controller
5.15. Spring boot with PostgreSQL
5.15.1. pom.xml
5.15.2. application.properties
5.15.3. Application
5.15.4. CrudRepository
5.15.5. JdbcTemplate
5.15.6. Controller
5.15.7. Test
5.16. Spring boot with Email
5.16.1. Maven
5.16.2. Resource
5.16.3. POJO
5.16.4. RestController
5.16.5. Test
5.17. Spring boot with Velocity template
5.17.1. Maven
5.17.2. Resource
5.17.3. Application
5.17.4. RestController
5.17.5. Test
5.18. Spring boot with Spring security
5.18.1. Maven
5.18.2. Reource
5.18.3. Application
5.18.4. WebSecurityConfigurer
5.18.5. RestController
5.18.6. 測試
5.18.7. Spring + Security + MongoDB
5.18.7.1. Account
5.18.7.2. AccountRepository
5.18.7.3. WebSecurityConfiguration
5.19. Spring boot with Scheduling
5.19.1. Application.java
5.19.2. Component
5.19.3. 查看日誌
5.19.4. 計劃任務控制
5.20. Spring boot with Cache
5.20.1. Spring boot with Redis
5.20.1.1. maven
5.20.1.2. application.properties
5.20.1.3. JUnit
5.20.1.4. Controller
5.20.2. @Cacheable
5.20.2.1. maven
5.20.2.2. Controller
5.21. Spring boot with Hessian
5.21.1. Maven
5.21.2. Application
5.21.3. HessianServiceExporter
5.21.4. Service
5.21.5. RestController
5.22. Spring boot with Apache Kafka
5.22.1. 安裝 kafka
5.22.2. maven
5.22.3. Spring boot Application
5.22.4. EnableKafka
5.22.5. KafkaListener
5.22.6. 測試
5.22.7. 完整的發佈訂閲實例
5.23. Spring boot with Git version
5.23.1. CommonRestController 公共控製器
5.23.2. VersionRestController 測試控製器
5.23.3. 創建 .gitattributes 檔案
5.24. Spring boot with HTTPS SSL
5.24.1. 生成自簽名證書
5.24.2. application..properties 配置檔案
5.24.3. 啟動 Spring boot
5.24.4. restTemplate 調用實例
5.25. Spring boot with Elasticsearch
5.25.1. Maven
5.25.2. Application
5.25.3. application.properties
5.25.4. Domain
5.25.5. ElasticsearchRepository
5.26. Spring boot with Apache Hive
5.26.1. Maven
5.26.2. application.properties
5.26.3. Configuration
5.27. Spring boot with Phoenix
5.27.1. Maven
5.27.2. application.properties
5.27.3. Configuration
5.28. Spring boot with Docker
5.28.1.
5.28.2.
5.28.3.
5.28.4.
5.29. FAQ
5.29.1. application.properties 參考
5.29.2. org.hibernate.dialect.Oracle10gDialect does not support identity key generation
5.29.3. No identifier specified for entity
5.29.4. Could not read document: Invalid UTF-8 middle byte 0xd0
5.29.5. java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
5.29.6. Field javaMailSender in cn.netkiller.rest.EmailRestController required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found.
5.29.7. org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "172.16.0.3", user "test", database "test ", SSL off
5.29.8. Spring boot 怎樣顯示執行的SQL語句
6. Tomcat Spring 運行環境
6.1. Maven
6.2. Spring Boot Quick start
6.2.1. pom.xml
6.2.2. Controller
6.3. Spring MVC configuration
6.4. Tomcat
6.5. 整合 Mybatis
6.5.1. pom.xml
6.5.2. properties
6.5.3. dataSource
6.5.4. SqlSessionFactory
6.5.5. Mapper 掃瞄
6.5.6. Mapper 單一class映射
6.5.7. Service
6.5.8. 測試實例
7. Spring MVC
7.1. @Controller
7.1.1. @RequestMapping
7.1.1.1. @RequestMapping("/")
7.1.1.2. 映射多個URL
7.1.1.3. headers
7.1.2. @ResponseBody
7.1.2.1. 直接返回HTML
7.1.3. RequestMapping with Path Variables - @PathVariable
7.1.3.1. URL 參數傳遞
7.1.3.2. URL 傳遞 Date 類型
7.1.3.3. 處理特殊字元
7.1.3.4. @PathVariable 注意事項
7.1.4. RequestMapping with Request Parameters - @RequestParam
7.1.4.1. HTTP GET
7.1.4.2. HTTP POST
7.1.4.3. @RequestParam 傳遞特殊字元串
7.1.4.4. 傳遞日期參數
7.1.5. @ModelAttribute
7.1.6. ModelAndView
7.1.6.1. 變數傳遞
7.1.6.2. ModelMap 傳遞多個變數
7.1.6.3. redirect
7.1.6.4. ArrayList
7.1.6.5. HashMap
7.1.6.6. 傳遞對象
7.1.6.7.
7.1.7. @Scheduled
7.1.8. @CrossOrigin
7.1.9. @SessionAttributes
7.1.10. HttpServletRequest / HttpServletResponse
7.1.10.1. HttpServletResponse
7.2. View
7.2.1. Using Spring’s form tag library
7.2.1.1. css
7.2.1.2. cssClass
7.2.2. Thymeleaf
7.2.2.1. Maven pom.xml
7.2.2.2. Spring 配置
7.2.2.3. controller
7.2.2.4. HTML5 Template
7.2.3. FreeMarker
7.3. Properties
7.3.1. 載入*.properties檔案
7.3.2. @Value 註解
7.3.3. @PropertySource 註解
7.4. FAQ
7.4.1. o.s.web.servlet.PageNotFound
7.4.2. HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
7.4.3. 同時使用 Thymeleaf 與 JSP
7.4.4. 排除靜態內容
7.4.5. HTTP Status 406
8. Spring Data
8.1. Redis
8.1.1. pom.xml
8.1.2. springframework-servlet.xml
8.1.3. Controller
8.1.4. index.jsp
8.1.5. 測試
8.2. Spring Data MongoDB
8.2.1. Example Spring Data MongoDB
8.2.1.1. pom.xml
8.2.1.2. springframework-servlet.xml
8.2.1.3. POJO
8.2.1.4. Controller
8.2.1.5. 查看測試結果
8.2.1.6. 條件查詢
8.2.2. @Document
8.2.2.1. @Indexed
8.2.2.2. @DateTimeFormat
8.2.2.3. @NumberFormat
8.2.2.4. 在 @Document 中使用 Enum 類型
8.2.2.5. 在 @Document 中定義資料結構 List/Map
8.2.3. MongoRepository
8.2.3.1. findAll()
8.2.3.2. deleteAll()
8.2.3.3. save()
8.2.3.4. count()
8.2.3.5. findByXXXX
8.2.3.6. StartingWith 和 EndingWith
8.2.3.7. Between
8.2.3.8. PageRequest
8.2.3.9. @Query
8.2.4. mongoTemplate
8.2.4.1. is
8.2.4.2. Regex 正則表達式搜索
8.2.4.3. lt 和 gt
8.2.4.4. between
8.2.4.5. Criteria
8.2.4.6. Sort
8.2.4.7. Query + PageRequest
8.2.4.8. newAggregation
8.3. Spring Data JPA
8.3.1. @Entity
8.3.1.1. @NotNull 不能為空聲明
8.3.1.2. 處理日期時間
8.3.2. Query
8.3.3. Repository
8.3.4. JdbcTemplate
8.3.4.1. execute
8.3.4.2. queryForInt
8.3.4.3. queryForObject
8.3.4.4. queryForList
8.4. FAQ
8.4.1. No identifier specified for entity
8.4.2. Oracle Date 類型顯示日期和時間
9. Spring Security
9.1. EnableWebSecurity
9.1.1. 訪問控制列表(Access Control List,ACL)
9.1.2. HTTP Auth
9.1.3. Rest
9.1.4. hasRole
9.1.5. Add User
9.2. 獲取當前用戶
9.3. HTTP 安全
10. RestTemplate - Spring4 Restful
10.1. RestTemplate Example
10.1.1. pom.xml
10.1.2. web.xml
10.1.3. springframework.xml
10.1.4. RestController
10.1.5. POJO
10.1.6. 測試
10.2. String boot with RestTemplate
10.2.1. 在控製器中完整實例
10.3. getForObject
10.3.1. 返回字元串
10.3.2. 傳遞 GET 參數
10.4. postForObject
10.4.1. 傳遞對象
10.4.2. 傳遞資料結構 MultiValueMap
10.5. postForEntity
10.6. PUT
10.7. Delete
10.8. HTTP Auth
10.8.1. Client
11. Interceptor
11.1. WebMvcConfigurerAdapter
11.2. HandlerInterceptor
12. Spring Cloud
12.1. Spring Cloud Config
12.1.1. Git 倉庫
12.1.2. Server
12.1.2.1. Maven pom.xml
12.1.2.2. Application
12.1.2.3. application.properties
12.1.2.4. 測試伺服器
12.1.3. Client
12.1.3.1. Maven pom.xml
12.1.3.2. Application
12.1.3.3. bootstrap.properties
12.1.3.4. 測試 client
12.1.4. Config server 用戶認證
12.1.4.1. Server 配置
12.1.4.2. Client 配置
12.1.5. 加密敏感數據
12.2. Spring Cloud Netflix
12.2.1. Eureka Server
12.2.1.1. Maven
12.2.1.2. Application
12.2.1.3. application.properties
12.2.1.4. 檢查註冊伺服器
12.2.2. Eureka Client
12.2.2.1. Maven
12.2.2.2. Application
12.2.2.3. RestController
12.2.2.4. application.properties
12.2.2.5. 測試
12.2.3. Feign client
12.2.3.1. Maven
12.2.3.2. Application
12.2.3.3. interface
12.2.3.4. application.properties
12.2.3.5. 測試