This commit is contained in:
Looly
2023-04-22 02:36:32 +08:00
parent 7387150f1a
commit 16e05bf9f5
108 changed files with 1244 additions and 857 deletions

View File

@@ -12,7 +12,7 @@
package org.dromara.hutool.extra.spring;
import org.dromara.hutool.core.exceptions.UtilException;
import org.dromara.hutool.core.exceptions.HutoolException;
import org.dromara.hutool.core.reflect.TypeReference;
import org.dromara.hutool.core.array.ArrayUtil;
import org.springframework.beans.BeansException;
@@ -85,7 +85,7 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
public static ListableBeanFactory getBeanFactory() {
final ListableBeanFactory factory = null == beanFactory ? applicationContext : beanFactory;
if(null == factory){
throw new UtilException("No ConfigurableListableBeanFactory or ApplicationContext injected, maybe not in the Spring environment?");
throw new HutoolException("No ConfigurableListableBeanFactory or ApplicationContext injected, maybe not in the Spring environment?");
}
return factory;
}
@@ -94,17 +94,17 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
* 获取{@link ConfigurableListableBeanFactory}
*
* @return {@link ConfigurableListableBeanFactory}
* @throws UtilException 当上下文非ConfigurableListableBeanFactory抛出异常
* @throws HutoolException 当上下文非ConfigurableListableBeanFactory抛出异常
* @since 5.7.7
*/
public static ConfigurableListableBeanFactory getConfigurableBeanFactory() throws UtilException {
public static ConfigurableListableBeanFactory getConfigurableBeanFactory() throws HutoolException {
final ConfigurableListableBeanFactory factory;
if (null != beanFactory) {
factory = beanFactory;
} else if (applicationContext instanceof ConfigurableApplicationContext) {
factory = ((ConfigurableApplicationContext) applicationContext).getBeanFactory();
} else {
throw new UtilException("No ConfigurableListableBeanFactory from context!");
throw new HutoolException("No ConfigurableListableBeanFactory from context!");
}
return factory;
}
@@ -268,7 +268,7 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
final DefaultSingletonBeanRegistry registry = (DefaultSingletonBeanRegistry) factory;
registry.destroySingleton(beanName);
} else {
throw new UtilException("Can not unregister bean, the factory is not a DefaultSingletonBeanRegistry!");
throw new HutoolException("Can not unregister bean, the factory is not a DefaultSingletonBeanRegistry!");
}
}

View File

@@ -12,7 +12,7 @@
package org.dromara.hutool.extra.xml;
import org.dromara.hutool.core.exceptions.UtilException;
import org.dromara.hutool.core.exceptions.HutoolException;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.io.IoUtil;
import org.dromara.hutool.core.text.StrUtil;
@@ -80,7 +80,7 @@ public class JAXBUtil {
writer = new StringWriter();
marshaller.marshal(bean, writer);
} catch (final Exception e) {
throw new UtilException("convertToXml 错误:" + e.getMessage(), e);
throw new HutoolException("convertToXml 错误:" + e.getMessage(), e);
}
return writer.toString();
}