mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
d6f8fb0077
commit
85c9dae9ae
@ -120,6 +120,7 @@ public class ReflectUtil {
|
||||
/**
|
||||
* 获取字段名,如果存在{@link Alias}注解,读取注解的值作为名称
|
||||
*
|
||||
* @param field 字段
|
||||
* @return 字段名
|
||||
* @since 5.1.6
|
||||
*/
|
||||
|
@ -1,11 +1,5 @@
|
||||
package cn.hutool.log;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.lang.caller.CallerUtil;
|
||||
import cn.hutool.core.util.ServiceLoaderUtil;
|
||||
@ -18,6 +12,12 @@ import cn.hutool.log.dialect.log4j2.Log4j2LogFactory;
|
||||
import cn.hutool.log.dialect.slf4j.Slf4jLogFactory;
|
||||
import cn.hutool.log.dialect.tinylog.TinyLogFactory;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 日志工厂类
|
||||
*
|
||||
@ -228,11 +228,10 @@ public abstract class LogFactory {
|
||||
*/
|
||||
private static LogFactory doCreate() {
|
||||
final ServiceLoader<LogFactory> factories = ServiceLoaderUtil.load(LogFactory.class);
|
||||
final Iterator<LogFactory> factoryIterator = factories.iterator();
|
||||
while(factoryIterator.hasNext()){
|
||||
try{
|
||||
return factoryIterator.next();
|
||||
} catch (NoClassDefFoundError e){
|
||||
for (LogFactory factory : factories) {
|
||||
try {
|
||||
return factory;
|
||||
} catch (ServiceConfigurationError e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user