提交 816ed30b 编写于 作者: 如梦技术's avatar 如梦技术 🐛

去除部分 spring-native 支持 #38 #I3PX2N

上级 15105fcb
......@@ -2,6 +2,5 @@ dependencies {
api project(":mica-core")
api "com.github.ben-manes.caffeine:caffeine"
api "org.springframework.boot:spring-boot-starter-cache"
compileOnly "org.springframework.experimental:spring-native:${springnativeVersion}"
annotationProcessor "net.dreamlu:mica-auto:${micaAutoVersion}"
}
......@@ -33,10 +33,6 @@ import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.Nullable;
import org.springframework.nativex.hint.AccessBits;
import org.springframework.nativex.hint.FieldHint;
import org.springframework.nativex.hint.NativeHint;
import org.springframework.nativex.hint.TypeHint;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
......@@ -54,45 +50,6 @@ import java.util.stream.Collectors;
@ConditionalOnMissingBean(CacheManager.class)
@ConditionalOnClass({Caffeine.class, CaffeineCacheManager.class})
@AutoConfigureBefore(name = "org.springframework.boot.autoconfigure.cache.CaffeineCacheConfiguration")
@NativeHint(types = {
@TypeHint(types = CaffeineAutoCacheManager.class, access = AccessBits.ALL),
@TypeHint(types = CaffeineCacheManager.class, access = AccessBits.ALL),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.UnsafeAccess",
fields = @FieldHint(name = "UNSAFE", allowUnsafeAccess = true),
access = AccessBits.PUBLIC_METHODS
),
@TypeHint(types = Thread.class, access = AccessBits.DECLARED_FIELDS),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.PS",
fields = {
@FieldHint(name = "key", allowUnsafeAccess = true),
@FieldHint(name = "value", allowUnsafeAccess = true)
},
access = AccessBits.DECLARED_CONSTRUCTORS
),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.PSA",
fields = @FieldHint(name = "accessTime", allowUnsafeAccess = true),
access = AccessBits.DECLARED_CONSTRUCTORS
),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.PSW",
fields = @FieldHint(name = "writeTime", allowUnsafeAccess = true),
access = AccessBits.DECLARED_CONSTRUCTORS
),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.StripedBuffer",
fields = {@FieldHint(name = "tableBusy", allowUnsafeAccess = true)},
access = AccessBits.ALL
),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.PSWMS", access = AccessBits.DECLARED_CONSTRUCTORS),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.SSA", access = AccessBits.ALL),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.SSLA", access = AccessBits.DECLARED_CONSTRUCTORS),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.SSLMSW", access = AccessBits.DECLARED_CONSTRUCTORS),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.SSMSW", access = AccessBits.DECLARED_CONSTRUCTORS),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.BoundedBuffer", access = AccessBits.ALL),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.BoundedBuffer$RingBuffer", access = AccessBits.ALL),
@TypeHint(typeNames = "com.github.benmanes.caffeine.cache.BLCHeader$DrainStatusRef",
fields = @FieldHint(name = "drainStatus", allowUnsafeAccess = true),
access = AccessBits.ALL
)
})
public class CaffeineAutoCacheConfiguration {
@Bean
......
......@@ -5,6 +5,5 @@ dependencies {
implementation "org.springframework.boot:spring-boot-autoconfigure"
compileOnly "org.springframework.cloud:spring-cloud-context"
compileOnly "net.dreamlu:mica-auto:${micaAutoVersion}"
compileOnly "org.springframework.experimental:spring-native:${springnativeVersion}"
annotationProcessor "net.dreamlu:mica-auto:${micaAutoVersion}"
}
......@@ -17,7 +17,6 @@
package net.dreamlu.mica.logging.config;
import net.dreamlu.mica.auto.annotation.AutoEnvPostProcessor;
import net.dreamlu.mica.core.graalvm.NativeUtil;
import net.dreamlu.mica.logging.utils.LoggingUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
......@@ -38,12 +37,6 @@ public class LoggingInitializer implements EnvironmentPostProcessor, Ordered {
String logBase = environment.getProperty("logging.file.path", LoggingUtil.DEFAULT_LOG_DIR);
// 用于 spring boot admin 中展示日志
System.setProperty("logging.file.name", logBase + "/${spring.application.name}/" + LoggingUtil.LOG_FILE_ALL);
// graal 下 logback 单独配置 issues: https://github.com/spring-projects-experimental/spring-native/issues/607
if (NativeUtil.inNativeImage()) {
String rootLogLevel = environment.getProperty("logging.level.root", "INFO");
System.setProperty("rootLogLevel", rootLogLevel);
System.setProperty("logging.config", "classpath:logback-spring-graalvm.xml");
}
}
@Override
......
......@@ -32,8 +32,6 @@ import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.nativex.hint.NativeHint;
import org.springframework.nativex.hint.ResourceHint;
import org.springframework.util.ClassUtils;
import java.lang.annotation.*;
......@@ -50,7 +48,6 @@ import java.util.Objects;
@Order(Ordered.HIGHEST_PRECEDENCE)
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(MicaLoggingProperties.class)
@NativeHint(resources = @ResourceHint(patterns = "^logback-spring-graalvm.xml"))
public class MicaLoggingConfiguration {
@Bean
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册