~~~
package com.supergo.zuul;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@EnableZuulProxy
@SpringBootApplication
public class ZuulApplication {
public static void main(String[] args) {
SpringApplication.run(ZuulApplication.class,args);
}
@Bean
//將允許跨域的Filter配置給網關
public CorsFilter corsFilter() {
//1.添加CORS配置信息
CorsConfiguration config = new CorsConfiguration();
//配置允許跨域的規則開始
//放行哪些原始域
config.addAllowedOrigin("*"); //* : 允許任何網站訪問
//是否發送Cookie信息
config.setAllowCredentials(true);
// 放行哪些原始域(頭部信息)
config.addAllowedHeader("*");
// 放行哪些原始域(請求方式)
config.addAllowedMethod("*");
// 暴露哪些頭部信息(因為跨域訪問默認不能獲取全部頭部信息)
//認證需要的自定義請求頭需要暴露的請求頭
//config.addExposedHeader("X-Token");
//配置允許跨域的規則結束
//2.添加映射路徑
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
//所有經過網關的請求都做添加跨域頭處理
configSource.registerCorsConfiguration("/**", config);
//創建過濾器
CorsFilter corsFilter = new CorsFilter(configSource);
return corsFilter;
}
}
~~~
- mybatis
- 基礎
- maven依賴
- 主配置文件
- 實體映射表
- Mapper接口
- xxxMapper.xml
- 代碼測試
- CURD
- 查詢操作
- 新增操作
- 修改操作
- 刪除操作
- 生命周期&作用域
- 實體類型配置別名
- 進階查詢
- 列名與屬性名不對應
- 多條件sql查詢
- 模糊查詢
- 獲取保存后的主鍵
- 動態sql
- where配合If
- where配合choose
- where配合foreach
- Sql片段
- 關聯查詢
- 表結構設計及實體類
- 多對一&一對一
- 一對多
- 多對多
- 嵌套查詢(多條sql)
- 多對一&一對一
- 一對多
- 多對多
- 加載策略
- 緩存
- 一級緩存
- 二級緩存
- 配置進階
- properties
- mapper注冊
- 連接池
- 注解開發
- spring
- 基礎
- maven依賴
- bean創建
- 基礎配置
- 測試代碼
- 簡單原理
- 構造方法創建對象
- 靜態工廠創建對象
- 動態工廠創建對象
- 作用域
- 初始化&銷毀方法
- 單例和原型作用域
- 依賴注入
- 構造方法注入
- set方法注入
- 集合&數組屬性注入
- 配置文件模塊化
- 注解配置
- 配置相關
- 注解釋義
- 純注解配置
- 小結
- Spring整合junit
- 依賴管理
- 使用
- Aop
- 依賴管理
- 配置相關
- aopDemo(非環繞通知)
- 名詞解釋
- 環繞通知
- xml混合注解Aop開發
- 純注解Aop
- Aop事務
- 代理相關
- 動態代理觀光代碼
- cglib代理觀光代碼
- SpringMVC
- 基礎
- 依賴管理
- 配置web.xml
- spring-mvc.xml
- idea tomcat配置
- Hello Controller
- Api解析
- @Controller
- @RequestMapping
- 編碼問題解決
- 獲取請求頭信息
- 獲取Cookie的值
- json相關
- 依賴管理
- 接收json請求參數
- 以json形式返回給客戶端
- restful風格
- 轉發
- 重定向
- 頁面傳值
- Request域
- Session域
- Aop異常處理
- 攔截器
- 番外篇
- Tomcat
- Servlet
- 創建
- 線程安全問題
- 生命周期相關
- Filter
- Listener
- ssm整合
- mybatis基礎篇
- mybatis依賴
- mybatis實體
- Mapper接口
- mybatis配置
- 測試代碼
- spring基礎篇
- 依賴
- AccountService接口
- AccountServiceImpl
- 測試代碼
- springmvc
- 依賴
- web.xml
- spring-mvc.xml
- AccountController
- spring整合mybatis
- 依賴
- 配置
- spring整合springmvc
- web.xml
- SpringBoot
- maven配置
- 引入SpringBoot技術
- 入口及測試控制器
- 打包插件
- 配置相關
- 配置實踐
- 配置自動適配
- 配置校驗
- 配置文件制定
- SpringBoot整合Junit
- 整合mybatis
- 依賴管理
- 配置相關
- @Mapper
- 整合freemarker
- 依賴管理
- 配置相關
- 測試控制器
- 目錄相關
- 驗證器
- maven依賴
- 驗證器定義
- 控制器接收參數
- 全局異常通知
- filter跨域解決方案
- 模板相關問題
- 上傳解決方案
- redis相關
- maven依賴管理
- 配置相關
- cache簡單封裝
- json處理
- SpringCloud
- 簡介
- 版本號
- eureka
- 簡介
- 組件
- eureka服務依賴
- eureka配置
- 項目啟動
- 父類依賴庫
- eureka_cli
- eureka客戶端依賴
- 配置項
- 啟動項
- eureka集群原理
- ribbon
- maven
- 配置
- 微服務實戰
- 項目架構
- 基類依賴
- eureka注冊中心
- 1依賴相關
- 2.配置相關
- 3.啟動項
- 業務service
- supergo-manager-service
- 依賴
- 配置
- 數據源監控
- 啟動項
- feign調用
- supergo-manager-feign
- 依賴
- 調用代碼
- 接口層
- supergo-manager-web
- 依賴
- 配置項
- 啟動項
- 通用mapper
- 逆向工程
- 數據庫連接配置
- 逆向工程配置
- 操作
- base-service
- 簡介
- 跨域
- 網關層
- zuul
- 依賴項
- 配置
- 啟動項