mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
优化SpringUtil在非Spring环境下的异常
This commit is contained in:
@@ -71,7 +71,11 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
|
||||
* @since 5.7.0
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user