mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
优化SpringUtil在非Spring环境下的异常
This commit is contained in:
parent
23b74ed7bf
commit
19eadb0f78
@ -2,12 +2,13 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.16.M1 (2023-03-17)
|
# 5.8.16.M1 (2023-03-20)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【core 】 改进Calculator.conversion,兼容乘法符号省略写法(issue#2964@Github)
|
* 【core 】 改进Calculator.conversion,兼容乘法符号省略写法(issue#2964@Github)
|
||||||
* 【core 】 改进XmlUtil.xmlToBean,支持xml转bean时父节点忽略大小写
|
* 【core 】 改进XmlUtil.xmlToBean,支持xml转bean时父节点忽略大小写
|
||||||
* 【core 】 优化ArrayUtil的空判断(pr#2969@Github)
|
* 【core 】 优化ArrayUtil的空判断(pr#2969@Github)
|
||||||
|
* 【extra 】 优化SpringUtil在非Spring环境下的异常(issue#2835@Github)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【crypto】 修复NoSuchMethodError未捕获问题(issue#2966@Github)
|
* 【crypto】 修复NoSuchMethodError未捕获问题(issue#2966@Github)
|
||||||
|
@ -71,7 +71,11 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
|
|||||||
* @since 5.7.0
|
* @since 5.7.0
|
||||||
*/
|
*/
|
||||||
public static ListableBeanFactory getBeanFactory() {
|
public static ListableBeanFactory getBeanFactory() {
|
||||||
return null == beanFactory ? applicationContext : beanFactory;
|
final ListableBeanFactory factory = null == beanFactory ? applicationContext : beanFactory;
|
||||||
|
if(null == factory){
|
||||||
|
throw new UtilException("No ConfigurableListableBeanFactory or ApplicationContext injected, maybe not in the Spring environment?");
|
||||||
|
}
|
||||||
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user