From 7c2f0fa7831a37124c0503d0fa9ec49065fc2576 Mon Sep 17 00:00:00 2001 From: aoshiguchen <1052045476@qq.com> Date: Sat, 10 Sep 2022 01:27:31 +0800 Subject: [PATCH] =?UTF-8?q?AsgcCompiler=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/aop/compiler/AsgcCompiler.java | 2 +- .../core/aop/compiler/DynamicClassLoader.java | 16 ++--- neutrino-proxy-server/pom.xml | 70 +++++++++---------- 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/AsgcCompiler.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/AsgcCompiler.java index 5baa68fe..3b520ddb 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/AsgcCompiler.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/AsgcCompiler.java @@ -69,7 +69,7 @@ public class AsgcCompiler { this.standardJavaFileManager = javaCompiler.getStandardFileManager(collector, null, null); this.isSaveClassFile = false; this.generatorCodeSavePath = GlobalConfig.getGeneratorCodeSavePath(); - this.dynamicClassLoader = new DynamicClassLoader(this, classLoader); + this.dynamicClassLoader = new DynamicClassLoader(classLoader, this); addOption("-Xlint:unchecked"); addOption("-implicit:class"); diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/DynamicClassLoader.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/DynamicClassLoader.java index 5abce963..0c1fe797 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/DynamicClassLoader.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/aop/compiler/DynamicClassLoader.java @@ -40,7 +40,7 @@ public class DynamicClassLoader extends ClassLoader { super(classLoader); } - public DynamicClassLoader(AsgcCompiler compiler, ClassLoader classLoader) { + public DynamicClassLoader(ClassLoader classLoader, AsgcCompiler compiler) { super(classLoader); this.compiler = compiler; } @@ -55,18 +55,16 @@ public class DynamicClassLoader extends ClassLoader { if (null != byteCode) { return super.defineClass(name, byteCode.getByteCode(), 0, byteCode.getByteCode().length); } - Class ret = doFindClass(name); - if (null != ret) { - return ret; + if (null != this.compiler) { + Class ret = doFindClass(name, compiler.getClasspathList()); + if (null != ret) { + return ret; + } } return super.findClass(name); } - private Class doFindClass(String name) throws ClassNotFoundException { - if (null == compiler) { - return null; - } - List classpathList = compiler.getClasspathList(); + private Class doFindClass(String name, List classpathList) throws ClassNotFoundException { if (CollectionUtil.isEmpty(classpathList)) { return null; } diff --git a/neutrino-proxy-server/pom.xml b/neutrino-proxy-server/pom.xml index c03c5659..5b337aea 100644 --- a/neutrino-proxy-server/pom.xml +++ b/neutrino-proxy-server/pom.xml @@ -32,54 +32,52 @@ - - - - - - - - - - - - - - - - - - - - - - - + ${artifactId} - maven-assembly-plugin + org.springframework.boot + spring-boot-maven-plugin + 2.1.3.RELEASE - - - - fun.asgc.neutrino.proxy.server.ProxyServer - - - - jar-with-dependencies - + fun.asgc.neutrino.proxy.server.ProxyServer - make-assembly - package - single + repackage + + + + + + + + + + + + + + + + + + + + + + + + + + + +