原创 Spring Boot 1.4 Unit Test

Spring Boot 1.4 對Unit Test有更好的支持。 以下代碼主要覆蓋: mock authentication 來測試帶權限的接口 使用jsonPath來做unit test 的 expectation i

原创 Nginx 收集

問題收集 反向代理後request的host和schema和瀏覽器請求不一致 反向代理後 下面如果不加proxy_set_header的兩行,那麼在microservice這個服務中,request.getScheme() +

原创 Shell 腳本 調用Mysql 客戶端定時導出數據

在mysql 服務端可以很方便的導出到文件,也有靈活的選擇。 如果需要導出的文件到其他服務器,不在mysql服務器上。 有兩個選擇: 在mysql 服務器上導出文件,通過sftp上傳至目標機器 在目標機器安裝mysql 客戶端,

原创 Spring Security 從單體到微服務的演進 - 單體web

參考:Spring Security and Angular JS 代碼:codes on github 術語 CSRF - Cross-Site Request Forgery (跨站請求僞造) CORS - Cross O

原创 Spring Cloud 服務註冊發現-路由-負載均衡-全鏈路日誌跟蹤-監控

Spring Cloud Netflix / Nodejs 嘗試使用Spring Cloud Netflix 加 Nodejs 技術棧混合搭建微服務。 (示例並無任何業務意義,只爲做演示) 代碼: https://github.

原创 使用Spring 構建多個moudle的web應用

A example to use demostrate how to create multiple project using spring boot. Go into Root Folder. Run mvn insta

原创 Spring Boot: 開發web 應用 - 01 創建項目

Spring Boot非常適合Web應用程序開發。使用spring-boot-starter-web模塊快速啓動和運行。 其中使用嵌入式Tomcat,Jetty或Undertow輕鬆創建自包含的HTTP服務器 Spring Boo

原创 Metricbeat 的使用

目標 統計並展示系統的信息 cpu, 內存等 (當然metricbeat能收集的信息種類還很多) 前提 版本: 5.x 已經安裝了ELK (elasticsearch, logstash (可選), kibana) 安裝了x-p

原创 Kibana 5.x 加強安全

此文之前,假定讀者已經一次完成了Kibana和elasticsearch的安裝。參考官方文檔,安裝後默認配置已經可以連通kibana和es。 系統: centos7 內容: 增加authentication & enabl

原创 Java 短ID 隨機字符串

使用apache common的lib 包。 用1000,0000 次測試,無重複字符串。 import java.io.File; import java.io.IOException; import java.util.Has

原创 SQL Used TO Retrieve country region from hybris

創建國家表 CREATE TABLE `country` ( `PK` bigint(20) NOT NULL DEFAULT '0', `activeflag` tinyint(1) DEFAULT NULL, `i

原创 Linux 腳本收集

括號的使用說明 參考:Double parenthesis with and without dollar $(…) means execute the command in the parens and return its

原创 ELK 日誌歸集

ELK 配置及設計 ​ 軟件及版本 CentOS 7 ​ Oracle JDK 8  Kibana 4.5.2  Elaticsearch 2.3.4  logstash 2.3.4  filebeat 1.2.3  查看ver

原创 Spring Boot Actuator

監控和管理 - Spring Boot Actuator Spring Boot Actuator是spring boot的一個子集,提供的一些監控用的API。 官方文檔 使用 只需要添加一下依賴 <dependency>

原创 Spring JPA Data Auditing

官方文檔 baeldung 示例 注意: 來自官方文檔: If you have multiple implementations registered in the ApplicationContext, you can