mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add sys props
This commit is contained in:
parent
37faf6d27b
commit
2ac275dd8f
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.0 (2022-03-21)
|
# 5.8.0 (2022-03-22)
|
||||||
|
|
||||||
### ❌不兼容特性
|
### ❌不兼容特性
|
||||||
* 【db 】 【不向下兼容 】增加MongoDB4.x支持返回MongoClient变更(pr#568@Gitee)
|
* 【db 】 【不向下兼容 】增加MongoDB4.x支持返回MongoClient变更(pr#568@Gitee)
|
||||||
@ -37,6 +37,7 @@
|
|||||||
* 【poi 】 优化ExcelBase,将alias放入
|
* 【poi 】 优化ExcelBase,将alias放入
|
||||||
* 【core 】 改进StrUtil#startWith、endWith性能
|
* 【core 】 改进StrUtil#startWith、endWith性能
|
||||||
* 【cron 】 增加CronPatternParser、MatcherTable
|
* 【cron 】 增加CronPatternParser、MatcherTable
|
||||||
|
* 【http 】 GlobalHeaders增加系统属性allowUnsafeServerCertChange、allowUnsafeRenegotiation
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复ObjectUtil.hasNull传入null返回true的问题(pr#555@Gitee)
|
* 【core 】 修复ObjectUtil.hasNull传入null返回true的问题(pr#555@Gitee)
|
||||||
|
@ -29,9 +29,10 @@ public class LazyFunLoader<T> extends LazyLoader<T> {
|
|||||||
* @param supplier 用于生成对象的函数
|
* @param supplier 用于生成对象的函数
|
||||||
* @param <T> 对象类型
|
* @param <T> 对象类型
|
||||||
* @return 函数式懒加载加载器对象
|
* @return 函数式懒加载加载器对象
|
||||||
|
* @since 5.8.0
|
||||||
*/
|
*/
|
||||||
public static <T> LazyFunLoader<T> onLoad(final Supplier<T> supplier) {
|
public static <T> LazyFunLoader<T> on(final Supplier<T> supplier) {
|
||||||
Assert.notNull(supplier, "supplier");
|
Assert.notNull(supplier, "supplier must be not null!");
|
||||||
return new LazyFunLoader<>(supplier);
|
return new LazyFunLoader<>(supplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class LazyFunLoaderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testOnLoadStaticFactoryMethod1() {
|
public void testOnLoadStaticFactoryMethod1() {
|
||||||
|
|
||||||
LazyFunLoader<BigObject> loader = LazyFunLoader.onLoad(BigObject::new);
|
LazyFunLoader<BigObject> loader = LazyFunLoader.on(BigObject::new);
|
||||||
|
|
||||||
Assert.assertNotNull(loader.get());
|
Assert.assertNotNull(loader.get());
|
||||||
Assert.assertTrue(loader.isInitialize());
|
Assert.assertTrue(loader.isInitialize());
|
||||||
@ -60,7 +60,7 @@ public class LazyFunLoaderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testOnLoadStaticFactoryMethod2() {
|
public void testOnLoadStaticFactoryMethod2() {
|
||||||
|
|
||||||
LazyFunLoader<BigObject> loader = LazyFunLoader.onLoad(BigObject::new);
|
LazyFunLoader<BigObject> loader = LazyFunLoader.on(BigObject::new);
|
||||||
|
|
||||||
// 若从未使用,则可以避免不必要的初始化
|
// 若从未使用,则可以避免不必要的初始化
|
||||||
loader.ifInitialized(it -> {
|
loader.ifInitialized(it -> {
|
||||||
|
@ -23,7 +23,7 @@ public enum GlobalHeaders {
|
|||||||
/**
|
/**
|
||||||
* 存储头信息
|
* 存储头信息
|
||||||
*/
|
*/
|
||||||
Map<String, List<String>> headers = new HashMap<>();
|
final Map<String, List<String>> headers = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
@ -43,6 +43,10 @@ public enum GlobalHeaders {
|
|||||||
// https://stackoverflow.com/questions/9096987/how-to-overwrite-http-header-host-in-a-httpurlconnection/9098440
|
// https://stackoverflow.com/questions/9096987/how-to-overwrite-http-header-host-in-a-httpurlconnection/9098440
|
||||||
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
|
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
|
||||||
|
|
||||||
|
//解决server certificate change is restricted during renegotiation问题
|
||||||
|
System.setProperty("jdk.tls.allowUnsafeServerCertChange", "true");
|
||||||
|
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
|
||||||
|
|
||||||
if (isReset) {
|
if (isReset) {
|
||||||
this.headers.clear();
|
this.headers.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user