mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-16 08:15:41 +00:00
chore[class]: adjust code
This commit is contained in:
1 parent
f7b06a086e
commit
f14488cdc8
2 files changed
+13
-1
No files matched your search
@@ -16,12 +16,15 @@ import com.zfoo.protocol.anno.Protocol;
|
|||||||
import com.zfoo.protocol.xml.XmlModuleDefinition;
|
import com.zfoo.protocol.xml.XmlModuleDefinition;
|
||||||
import com.zfoo.protocol.xml.XmlProtocolDefinition;
|
import com.zfoo.protocol.xml.XmlProtocolDefinition;
|
||||||
import com.zfoo.protocol.xml.XmlProtocols;
|
import com.zfoo.protocol.xml.XmlProtocols;
|
||||||
|
import io.netty.buffer.AbstractByteBufAllocator;
|
||||||
|
import io.netty.buffer.AbstractReferenceCountedByteBuf;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.aot.hint.RuntimeHints;
|
import org.springframework.aot.hint.RuntimeHints;
|
||||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register runtime hints for the token library
|
* Register runtime hints for the token library
|
||||||
@@ -45,5 +48,12 @@ public class GraalvmProtocolHints implements RuntimeHintsRegistrar {
|
|||||||
classes.addAll(filterClasses);
|
classes.addAll(filterClasses);
|
||||||
|
|
||||||
HintUtils.registerRelevantClasses(hints, classes);
|
HintUtils.registerRelevantClasses(hints, classes);
|
||||||
|
|
||||||
|
// netty
|
||||||
|
HintUtils.registerClasses(hints, List.of(AbstractByteBufAllocator.class, AbstractReferenceCountedByteBuf.class));
|
||||||
|
|
||||||
|
var include = "*.protocol";
|
||||||
|
hints.resources().registerPattern(include);
|
||||||
|
logger.info("Protocol graalvm aot hints register resources [{}]", include);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,9 @@ public abstract class ClassUtils {
|
|||||||
* @param filePath 一般指resources中的文件,也可以在jar中
|
* @param filePath 一般指resources中的文件,也可以在jar中
|
||||||
*/
|
*/
|
||||||
public static InputStream getFileFromClassPath(String filePath) throws IOException {
|
public static InputStream getFileFromClassPath(String filePath) throws IOException {
|
||||||
return getDefaultClassLoader().getResource(filePath).openStream();
|
var classLoader = getDefaultClassLoader();
|
||||||
|
var resource = classLoader.getResource(filePath);
|
||||||
|
return resource.openStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileFromClassPathToString(String filePath) {
|
public static String getFileFromClassPathToString(String filePath) {
|
||||||
|
|||||||
Reference in new issue
Block a user