mirror of
https://gitee.com/incloudcode/yexuejc-springboot.git
synced 2025-07-19 18:19:31 +08:00
1.0.16
This commit is contained in:
parent
2379043867
commit
bc3313861b
13
UPDATE.md
13
UPDATE.md
@ -1,6 +1,19 @@
|
|||||||
yexuejc-springboot 更新内容
|
yexuejc-springboot 更新内容
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
#### version :1.0.16
|
||||||
|
**time:2018-9-23 12:46:26** <br/>
|
||||||
|
**branch:** master <br/>
|
||||||
|
**关联工程:** <br/>
|
||||||
|
```
|
||||||
|
springboot-base:1.1.9
|
||||||
|
spring-boot-starter-parent:1.5.15.RELEASE
|
||||||
|
```
|
||||||
|
**update:** <br/>
|
||||||
|
1. 升级依赖
|
||||||
|
2. 增加SSL证书忽略:默认关闭
|
||||||
|
#
|
||||||
|
|
||||||
#### version :1.0.15
|
#### version :1.0.15
|
||||||
**time:2018-9-3 19:29:39** <br/>
|
**time:2018-9-3 19:29:39** <br/>
|
||||||
**branch:** master <br/>
|
**branch:** master <br/>
|
||||||
|
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.yexuejc.springboot</groupId>
|
<groupId>com.yexuejc.springboot</groupId>
|
||||||
<artifactId>yexuejc-springboot-parent</artifactId>
|
<artifactId>yexuejc-springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>1.0.16</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<yexuejc.base.version>1.1.8</yexuejc.base.version>
|
<yexuejc.base.version>1.1.9</yexuejc.base.version>
|
||||||
<repos.yexuejc.url>https://nexus.yexuejc.club/repository/</repos.yexuejc.url>
|
<repos.yexuejc.url>https://nexus.yexuejc.club/repository/</repos.yexuejc.url>
|
||||||
|
|
||||||
<repos.aliyun.url>http://maven.aliyun.com/nexus/content/groups/public</repos.aliyun.url>
|
<repos.aliyun.url>http://maven.aliyun.com/nexus/content/groups/public</repos.aliyun.url>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.yexuejc.springboot</groupId>
|
<groupId>com.yexuejc.springboot</groupId>
|
||||||
<artifactId>yexuejc-springboot-parent</artifactId>
|
<artifactId>yexuejc-springboot-parent</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>1.0.16</version>
|
||||||
<!-- 本地打包:使用相对关联路径 -->
|
<!-- 本地打包:使用相对关联路径 -->
|
||||||
<!--<relativePath>../../yexuejc</relativePath>-->
|
<!--<relativePath>../../yexuejc</relativePath>-->
|
||||||
</parent>
|
</parent>
|
||||||
|
@ -16,6 +16,7 @@ import com.yexuejc.springboot.base.filter.ValidationFilter;
|
|||||||
import com.yexuejc.springboot.base.filter.ValidationFilterProperties;
|
import com.yexuejc.springboot.base.filter.ValidationFilterProperties;
|
||||||
import com.yexuejc.springboot.base.interceptor.LogInterceptor;
|
import com.yexuejc.springboot.base.interceptor.LogInterceptor;
|
||||||
import com.yexuejc.springboot.base.util.LogUtil;
|
import com.yexuejc.springboot.base.util.LogUtil;
|
||||||
|
import com.yexuejc.springboot.base.util.SSLUtil;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
@ -147,6 +148,15 @@ public class WebAutoConfiguration extends WebMvcConfigurerAdapter {
|
|||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
/**
|
||||||
|
* 是否开启HTTPS(SSL)请求证书验证忽略:默认false
|
||||||
|
*/
|
||||||
|
@ConditionalOnProperty(name = "yexuejc.enable.ssl-ignore", matchIfMissing = false)
|
||||||
|
public SSLUtil getSslUtil() {
|
||||||
|
return new SSLUtil();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局异常处理
|
* 全局异常处理
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.yexuejc.springboot.base.util;
|
||||||
|
|
||||||
|
import javax.net.ssl.*;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SSL证书忽略
|
||||||
|
*
|
||||||
|
* @ClassName: SSLUtil
|
||||||
|
* @Description:
|
||||||
|
* @author: maxf
|
||||||
|
* @date: 2018/9/23 12:26:33
|
||||||
|
*/
|
||||||
|
public class SSLUtil {
|
||||||
|
|
||||||
|
|
||||||
|
public SSLUtil() {
|
||||||
|
disableSslVerification();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void disableSslVerification() {
|
||||||
|
try {
|
||||||
|
// Create a trust manager that does not validate certificate chains
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
|
||||||
|
@Override
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(X509Certificate[] certs, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(X509Certificate[] certs, String authType) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Install the all-trusting trust manager
|
||||||
|
SSLContext sc = SSLContext.getInstance("SSL");
|
||||||
|
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||||
|
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||||
|
|
||||||
|
// Create all-trusting host name verifier
|
||||||
|
HostnameVerifier allHostsValid = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Install the all-trusting host verifier
|
||||||
|
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (KeyManagementException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,4 +21,7 @@ yexuejc.http.encrypt.private-pwd=lgfishing2018
|
|||||||
spring.http.encoding.force=true
|
spring.http.encoding.force=true
|
||||||
spring.http.encoding.charset=UTF-8
|
spring.http.encoding.charset=UTF-8
|
||||||
spring.http.encoding.enabled=true
|
spring.http.encoding.enabled=true
|
||||||
server.tomcat.uri-encoding=UTF-8
|
server.tomcat.uri-encoding=UTF-8
|
||||||
|
|
||||||
|
#是否开启HTTPS(SSL)请求证书验证忽略:默认false
|
||||||
|
yexuejc.enable.ssl-ignore=true
|
Loading…
x
Reference in New Issue
Block a user