From 0ccb49afde70472e714827bf11c458b8962aeea6 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 30 Aug 2022 11:23:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=BB=E8=BE=91=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/synebula/gaea/spring/aop/AppAspect.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gaea.spring/src/main/kotlin/com/synebula/gaea/spring/aop/AppAspect.kt b/src/gaea.spring/src/main/kotlin/com/synebula/gaea/spring/aop/AppAspect.kt index 077ecf8..c36f312 100644 --- a/src/gaea.spring/src/main/kotlin/com/synebula/gaea/spring/aop/AppAspect.kt +++ b/src/gaea.spring/src/main/kotlin/com/synebula/gaea/spring/aop/AppAspect.kt @@ -89,12 +89,13 @@ abstract class AppAspect { val module = clazz.annotations.find { it is Module } if (module != null && module is Module) { moduleName = module.name - } - // 3.尝试找类的name字段作为模块名称 - try { - val nameGetter = clazz.getMethod("getName") - moduleName = nameGetter.invoke(obj).toString() - } catch (_: NoSuchMethodException) { + } else { + // 3.尝试找类的name字段作为模块名称 + try { + val nameGetter = clazz.getMethod("getName") + moduleName = nameGetter.invoke(obj).toString() + } catch (_: NoSuchMethodException) { + } } return moduleName