From 1147482a10bf6d11b499222f3caf8398b2a75124 Mon Sep 17 00:00:00 2001 From: trydofor Date: Sat, 29 Jun 2024 13:10:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5keep=20silencer=20simple=20#265?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/Devops7EnumsDumperTest.java | 4 +- observe/docs | 2 +- .../tiny/mail/sender/TinyMailConfig.java | 4 +- .../service/impl/TinyMailServiceImpl.java | 16 +-- .../tiny/mail/service/ResourceMapTest.java | 4 +- .../service/impl/TinyTaskExecServiceImpl.java | 6 +- .../spring/prop/FacelessJooqCudProp.java | 4 +- .../wings/silencer/common/Splitter.java | 104 ------------------ .../wings/silencer/enhance/ThisLazy.java | 0 .../wings/silencer/enhance/ThisLazyAware.java | 0 .../enhance/ThisLazyPostProcessor.java | 0 .../bean/SilencerCurseConfiguration.java | 29 +++-- .../app/TestSilencerCurseApplication.java | 3 + .../silencer/app/conf/TestMergingProp.java | 0 .../app/service/TestThisLazyService.java | 0 .../impl/TestThisLazyServiceEnhanced.java | 0 .../impl/TestThisLazyServiceItself.java | 0 .../impl/TestThisLazyServiceProxy.java | 0 .../silencer/enhance/ThisLazyCglibTest.java | 0 .../silencer/enhance/ThisLazyProxyTest.java | 0 .../spring/boot/WingsSilencerMergeTest.java | 0 .../spring/help/CommonPropHelperTest.java | 44 -------- .../wings-conf/wings-merge-a.properties | 0 .../wings-conf/wings-merge-b.properties | 0 .../spring/bean/SilencerConfiguration.java | 10 -- .../silencer/support/InspectHelper.java} | 11 +- .../wings/silencer/support/PropHelper.java} | 6 +- .../silencer/support/SubclassGather.java} | 6 +- .../{enhance => support}/TypeSugar.java | 2 +- .../silencer/app/TestSilencerApplication.java | 3 - .../silencer/support/InspectHelperTest.java} | 30 ++--- .../silencer/support/PropHelperTest.java | 44 ++++++++ .../{enhance => support}/TypeSugarMain.java | 3 +- .../{enhance => support}/TypeSugarTest.java | 41 +++---- .../impl/WingsCookieInterceptorImpl.java | 2 +- .../bean/SlardarRemoteConfiguration.java | 8 +- .../bean/SlardarSwaggerConfiguration.java | 4 +- .../slardar/json/WingsJacksonMapperTest.java | 2 +- .../slardar/fastjson/FastJsonHelper.java | 2 +- .../jackson/AesStringDeserializer.java | 2 +- .../slardar/jackson/AesStringSerializer.java | 2 +- .../wings/slardar/jackson/JacksonHelper.java | 2 +- .../slardar/jackson/ResourceSerializer.java | 4 +- .../wings/slardar/notice/DingTalkConf.java | 4 +- .../bean/SlardarMonitorConfiguration.java | 6 +- .../wings/slardar/json/TypeReferenceTest.java | 2 +- .../security/justauth/AuthStateBuilder.java | 2 +- .../WarlockSecurityBeanConfiguration.java | 4 +- .../WarlockSecurityConfConfiguration.java | 12 +- .../spring/prop/WarlockSecurityProp.java | 4 +- .../service/conf/RuntimeConfService.java | 2 +- .../conf/impl/RuntimeConfServiceImpl.java | 2 +- .../service/conf/RuntimeConfServiceTest.java | 2 +- 53 files changed, 170 insertions(+), 274 deletions(-) delete mode 100644 wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/common/Splitter.java rename wings/{silencer => silencer-curse}/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazy.java (100%) rename wings/{silencer => silencer-curse}/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyAware.java (100%) rename wings/{silencer => silencer-curse}/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyPostProcessor.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/app/conf/TestMergingProp.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/app/service/TestThisLazyService.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceEnhanced.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceItself.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceProxy.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyCglibTest.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyProxyTest.java (100%) rename wings/{silencer => silencer-curse}/src/test/java/pro/fessional/wings/silencer/spring/boot/WingsSilencerMergeTest.java (100%) delete mode 100644 wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/CommonPropHelperTest.java rename wings/{silencer => silencer-curse}/src/test/resources/wings-conf/wings-merge-a.properties (100%) rename wings/{silencer => silencer-curse}/src/test/resources/wings-conf/wings-merge-b.properties (100%) rename wings/{silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelper.java => silencer/src/main/java/pro/fessional/wings/silencer/support/InspectHelper.java} (86%) rename wings/{silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/CommonPropHelper.java => silencer/src/main/java/pro/fessional/wings/silencer/support/PropHelper.java} (98%) rename wings/{silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/SubclassSpringLoader.java => silencer/src/main/java/pro/fessional/wings/silencer/support/SubclassGather.java} (95%) rename wings/silencer/src/main/java/pro/fessional/wings/silencer/{enhance => support}/TypeSugar.java (99%) rename wings/{silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelperTest.java => silencer/src/test/java/pro/fessional/wings/silencer/support/InspectHelperTest.java} (58%) create mode 100644 wings/silencer/src/test/java/pro/fessional/wings/silencer/support/PropHelperTest.java rename wings/silencer/src/test/java/pro/fessional/wings/silencer/{enhance => support}/TypeSugarMain.java (96%) rename wings/silencer/src/test/java/pro/fessional/wings/silencer/{enhance => support}/TypeSugarTest.java (81%) diff --git a/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops7EnumsDumperTest.java b/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops7EnumsDumperTest.java index cd3d9d34f..8e0d54582 100644 --- a/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops7EnumsDumperTest.java +++ b/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops7EnumsDumperTest.java @@ -8,7 +8,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.core.io.ResourceLoader; import pro.fessional.mirana.data.CodeEnum; -import pro.fessional.wings.silencer.spring.help.SubclassSpringLoader; +import pro.fessional.wings.silencer.support.SubclassGather; import java.util.Map; @@ -27,7 +27,7 @@ public class Devops7EnumsDumperTest { @Test public void dumpCodeEnum() { - SubclassSpringLoader loader = new SubclassSpringLoader(resourceLoader); + SubclassGather loader = new SubclassGather(resourceLoader); Class superEnum = CodeEnum.class; Map, Enum[]> enums = loader.loadSubEnums("pro.fessional", superEnum); diff --git a/observe/docs b/observe/docs index 6d6c110a6..e1df9bdee 160000 --- a/observe/docs +++ b/observe/docs @@ -1 +1 @@ -Subproject commit 6d6c110a640c4bbfc56b19fd7b177f690d758afc +Subproject commit e1df9bdeefc83fdf5720de4b6bcf6b1ca075ae3d diff --git a/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/sender/TinyMailConfig.java b/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/sender/TinyMailConfig.java index 3a5f7b527..aa3e5afec 100644 --- a/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/sender/TinyMailConfig.java +++ b/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/sender/TinyMailConfig.java @@ -9,8 +9,8 @@ import java.util.Arrays; import java.util.Objects; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.mergeIfNon; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.nonValue; +import static pro.fessional.wings.silencer.support.PropHelper.mergeIfNon; +import static pro.fessional.wings.silencer.support.PropHelper.nonValue; /** * hashCode and equals with diff --git a/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/service/impl/TinyMailServiceImpl.java b/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/service/impl/TinyMailServiceImpl.java index f254e18d0..0e1732775 100644 --- a/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/service/impl/TinyMailServiceImpl.java +++ b/radiant/tiny-mail/src/main/java/pro/fessional/wings/tiny/mail/service/impl/TinyMailServiceImpl.java @@ -30,7 +30,7 @@ import pro.fessional.wings.silencer.modulate.RunMode; import pro.fessional.wings.silencer.modulate.RuntimeMode; import pro.fessional.wings.silencer.spring.boot.ConditionalWingsEnabled; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import pro.fessional.wings.slardar.fastjson.FastJsonHelper; import pro.fessional.wings.tiny.mail.database.autogen.tables.WinMailSenderTable; import pro.fessional.wings.tiny.mail.database.autogen.tables.daos.WinMailSenderDao; @@ -58,8 +58,8 @@ import java.util.concurrent.atomic.AtomicInteger; import static org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.DEFAULT_TASK_SCHEDULER_BEAN_NAME; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.arrayOrNull; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.nonValue; +import static pro.fessional.wings.silencer.support.PropHelper.commaArray; +import static pro.fessional.wings.silencer.support.PropHelper.nonValue; /** * @author trydofor @@ -280,9 +280,9 @@ private TinyMailMessage makeMailMessage(@NotNull TinyMailConfig config, @NotNull if (msg == null) { message.setFrom(po.getMailFrom()); - message.setTo(arrayOrNull(po.getMailTo(), true)); - message.setCc(arrayOrNull(po.getMailCc(), true)); - message.setBcc(arrayOrNull(po.getMailBcc(), true)); + message.setTo(commaArray(po.getMailTo())); + message.setCc(commaArray(po.getMailCc())); + message.setBcc(commaArray(po.getMailBcc())); message.setReply(EmptySugar.emptyToNull(po.getMailReply())); message.setHtml(po.getMailHtml()); message.setSubject(po.getMailSubj()); @@ -716,7 +716,7 @@ private String stringResource(Map file) { Map nameUrl = new LinkedHashMap<>(); for (Map.Entry en : file.entrySet()) { - nameUrl.put(en.getKey(), CommonPropHelper.stringResource(en.getValue())); + nameUrl.put(en.getKey(), PropHelper.stringResource(en.getValue())); } return toString(nameUrl); } @@ -728,7 +728,7 @@ private Map resourceString(String jsonMap) { final Map rst = new LinkedHashMap<>(); Map map = FastJsonHelper.object(jsonMap, Map.class, String.class, String.class); for (Map.Entry en : map.entrySet()) { - rst.put(en.getKey(), CommonPropHelper.resourceString(en.getValue(), resourceLoader)); + rst.put(en.getKey(), PropHelper.resourceString(en.getValue(), resourceLoader)); } return rst; } diff --git a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/ResourceMapTest.java b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/ResourceMapTest.java index f894e8e3f..6369ca7d3 100644 --- a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/ResourceMapTest.java +++ b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/ResourceMapTest.java @@ -9,7 +9,7 @@ import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import java.io.IOException; import java.util.Iterator; @@ -36,7 +36,7 @@ public void jsonResourceSerializer() throws IOException { Map urls = new LinkedHashMap<>(); for (Map.Entry en : res1.entrySet()) { - urls.put(en.getKey(), CommonPropHelper.stringResource(en.getValue())); + urls.put(en.getKey(), PropHelper.stringResource(en.getValue())); } final String json = objectMapper.writeValueAsString(urls); Map res2 = new LinkedHashMap<>(); diff --git a/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskExecServiceImpl.java b/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskExecServiceImpl.java index 6616a82f1..36edca634 100644 --- a/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskExecServiceImpl.java +++ b/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskExecServiceImpl.java @@ -57,7 +57,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.arrayOrNull; +import static pro.fessional.wings.silencer.support.PropHelper.commaArray; import static pro.fessional.wings.tiny.task.schedule.exec.NoticeExec.WhenDone; import static pro.fessional.wings.tiny.task.schedule.exec.NoticeExec.WhenExec; import static pro.fessional.wings.tiny.task.schedule.exec.NoticeExec.WhenFail; @@ -316,7 +316,7 @@ private boolean notEnable(Boolean b, long id, String key) { private boolean notApps(String apps, long id, String key) { if (StringUtils.isEmpty(apps)) return false; - for (String s : arrayOrNull(apps, true)) { + for (String s : commaArray(apps)) { if (s.trim().equals(appName)) return false; } log.info("skip tiny-task for not apps={}, cur={}, id={}, prop={}", apps, appName, id, key); @@ -343,7 +343,7 @@ private boolean notRuns(String runs, long id, String key) { private Set noticeWhen(String nw) { if (nw == null || nw.isEmpty()) return Collections.emptySet(); Set rs = new HashSet<>(); - for (String s : arrayOrNull(nw, true)) { + for (String s : commaArray(nw)) { rs.add(s.trim().toLowerCase()); } return rs; diff --git a/wings/faceless-jooq/src/main/java/pro/fessional/wings/faceless/spring/prop/FacelessJooqCudProp.java b/wings/faceless-jooq/src/main/java/pro/fessional/wings/faceless/spring/prop/FacelessJooqCudProp.java index abf283321..9e561812b 100644 --- a/wings/faceless-jooq/src/main/java/pro/fessional/wings/faceless/spring/prop/FacelessJooqCudProp.java +++ b/wings/faceless-jooq/src/main/java/pro/fessional/wings/faceless/spring/prop/FacelessJooqCudProp.java @@ -11,7 +11,7 @@ import java.util.Map; import java.util.Set; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.DisabledValue; +import static pro.fessional.wings.silencer.support.PropHelper.DisabledValue; /** * CUD listener settings for jooq. @@ -56,7 +56,7 @@ public class FacelessJooqCudProp { * Listening tables and their fields. `empty` means no fields are recorded, `-` means this table is ignored. * CUD listens to tables and fields, both tables and fields are case-sensitive. * - * @see pro.fessional.wings.silencer.spring.help.CommonPropHelper#DisabledValue + * @see pro.fessional.wings.silencer.support.PropHelper#DisabledValue * @see #Key$table */ private Map> table = Collections.emptyMap(); diff --git a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/common/Splitter.java b/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/common/Splitter.java deleted file mode 100644 index cf23afb57..000000000 --- a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/common/Splitter.java +++ /dev/null @@ -1,104 +0,0 @@ -package pro.fessional.wings.silencer.common; - -import org.apache.commons.lang3.StringUtils; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.function.Function; - -/** - * @author trydofor - * @since 2023-06-13 - */ -public class Splitter { - - /** - * split string by separator - * - * @param sep separator - * @param str string - * @return list of string - * @see com.google.common.base.Splitter - */ - @NotNull - public static List list(@NotNull String sep, String str) { - if (str == null || str.isEmpty()) return Collections.emptyList(); - return com.google.common.base.Splitter.on(sep).splitToList(str); - } - - /** - * split string by separator - * - * @param sep separator - * @param str string - * @param max max items - * @return list of string - * @see com.google.common.base.Splitter - */ - @NotNull - public static List list(@NotNull String sep, String str, int max) { - if (str == null || str.isEmpty()) return Collections.emptyList(); - return com.google.common.base.Splitter.on(sep).limit(max).splitToList(str); - } - - /** - * split string by separator and convert to T - * - * @param sep separator - * @param str string - * @param fun convert string to T - * @return list of T - * @see com.google.common.base.Splitter - */ - @NotNull - public static List list(@NotNull String sep, String str, @NotNull Function fun) { - if (str == null || str.isEmpty()) return Collections.emptyList(); - final Iterable iter = com.google.common.base.Splitter.on(sep).split(str); - List result = new ArrayList<>(); - for (String s : iter) { - result.add(fun.apply(s)); - } - return Collections.unmodifiableList(result); - } - - /** - * split string by separator and convert to T - * - * @param sep separator - * @param str string - * @param max max items - * @param fun convert string to T - * @return list of T - * @see com.google.common.base.Splitter - */ - @NotNull - public static List list(@NotNull String sep, String str, int max, @NotNull Function fun) { - if (str == null || str.isEmpty()) return Collections.emptyList(); - final Iterable iter = com.google.common.base.Splitter.on(sep).limit(max).split(str); - List result = new ArrayList<>(); - for (String s : iter) { - result.add(fun.apply(s)); - } - return Collections.unmodifiableList(result); - } - - /** - * count items split by separator - *
-     * 0 - if str is empty
-     * 1 - if str does not contain sep
-     * n+1 - if str contains n sep
-     * 
- * - * @param sep separator - * @param str string - * @return count of items - * @see StringUtils#countMatches(CharSequence, CharSequence) - */ - public static int count(@NotNull String sep, String str) { - if (str == null || str.isEmpty()) return 0; - return StringUtils.countMatches(str, sep) + 1; - } -} diff --git a/wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazy.java b/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazy.java similarity index 100% rename from wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazy.java rename to wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazy.java diff --git a/wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyAware.java b/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyAware.java similarity index 100% rename from wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyAware.java rename to wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyAware.java diff --git a/wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyPostProcessor.java b/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyPostProcessor.java similarity index 100% rename from wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyPostProcessor.java rename to wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/enhance/ThisLazyPostProcessor.java diff --git a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerCurseConfiguration.java b/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerCurseConfiguration.java index 594467e19..f0a0bcdcd 100644 --- a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerCurseConfiguration.java +++ b/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerCurseConfiguration.java @@ -8,18 +8,20 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.info.GitProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import pro.fessional.wings.silencer.enhance.ThisLazyPostProcessor; import pro.fessional.wings.silencer.modulate.RuntimeMode; import pro.fessional.wings.silencer.runner.ApplicationInspectRunner; import pro.fessional.wings.silencer.runner.ApplicationReadyEventRunner; import pro.fessional.wings.silencer.spring.WingsOrdered; import pro.fessional.wings.silencer.spring.boot.ConditionalWingsEnabled; import pro.fessional.wings.silencer.spring.help.ApplicationContextHelper; -import pro.fessional.wings.silencer.spring.help.VersionInfoHelper; +import pro.fessional.wings.silencer.support.InspectHelper; import pro.fessional.wings.silencer.spring.prop.SilencerAutoLogProp; import pro.fessional.wings.silencer.spring.prop.SilencerEnabledProp; import pro.fessional.wings.silencer.spring.prop.SilencerRuntimeProp; @@ -84,17 +86,17 @@ public ApplicationInspectRunner infoGitJvmRunner(ApplicationContext context) { return new ApplicationInspectRunner(WingsOrdered.Lv1Config, args -> { - log.info("jvm-name=" + VersionInfoHelper.jvmName()); - log.info("jvm-version=" + VersionInfoHelper.jvmVersion()); - log.info("jvm-vendor=" + VersionInfoHelper.jvmVendor()); + log.info("jvm-name=" + InspectHelper.jvmName()); + log.info("jvm-version=" + InspectHelper.jvmVersion()); + log.info("jvm-vendor=" + InspectHelper.jvmVendor()); var git = context.getBean(GitProperties.class); - log.info("git-branch=" + VersionInfoHelper.branch(git)); - log.info("git-id=" + VersionInfoHelper.commitId(git)); - log.info("git-time=" + VersionInfoHelper.commitDateTime(git)); - log.info("git-build=" + VersionInfoHelper.buildDateTime(git)); - log.info("git-version=" + VersionInfoHelper.buildVersion(git)); - log.info("git-message=" + VersionInfoHelper.commitMessage(git)); + log.info("git-branch=" + InspectHelper.branch(git)); + log.info("git-id=" + InspectHelper.commitId(git)); + log.info("git-time=" + InspectHelper.commitDateTime(git)); + log.info("git-build=" + InspectHelper.buildDateTime(git)); + log.info("git-version=" + InspectHelper.buildVersion(git)); + log.info("git-message=" + InspectHelper.commitMessage(git)); }); } @@ -152,6 +154,13 @@ else if (exists.contains(name)) { }); } + @Bean + @ConditionalWingsEnabled + public static BeanPostProcessor thisLazyAwarePostProcessor() { + log.info("Silencer spring-auto thisLazyAwarePostProcessor"); + return new ThisLazyPostProcessor(); + } + @Bean @ConditionalWingsEnabled public RuntimeMode runtimeMode(SilencerRuntimeProp prop) { diff --git a/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/TestSilencerCurseApplication.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/TestSilencerCurseApplication.java index 27197d7c1..04889639f 100644 --- a/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/TestSilencerCurseApplication.java +++ b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/TestSilencerCurseApplication.java @@ -2,13 +2,16 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import pro.fessional.wings.silencer.app.conf.TestMergingProp; /** * @author trydofor * @since 2019-07-20 */ @SpringBootApplication +@EnableConfigurationProperties(TestMergingProp.class) public class TestSilencerCurseApplication { public interface InnerFace { diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/conf/TestMergingProp.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/conf/TestMergingProp.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/app/conf/TestMergingProp.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/conf/TestMergingProp.java diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/TestThisLazyService.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/TestThisLazyService.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/TestThisLazyService.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/TestThisLazyService.java diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceEnhanced.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceEnhanced.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceEnhanced.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceEnhanced.java diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceItself.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceItself.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceItself.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceItself.java diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceProxy.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceProxy.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceProxy.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/app/service/impl/TestThisLazyServiceProxy.java diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyCglibTest.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyCglibTest.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyCglibTest.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyCglibTest.java diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyProxyTest.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyProxyTest.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyProxyTest.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/enhance/ThisLazyProxyTest.java diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/spring/boot/WingsSilencerMergeTest.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/boot/WingsSilencerMergeTest.java similarity index 100% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/spring/boot/WingsSilencerMergeTest.java rename to wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/boot/WingsSilencerMergeTest.java diff --git a/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/CommonPropHelperTest.java b/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/CommonPropHelperTest.java deleted file mode 100644 index 924c4afdc..000000000 --- a/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/CommonPropHelperTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package pro.fessional.wings.silencer.spring.help; - -import io.qameta.allure.TmsLink; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.util.List; - -/** - * @author trydofor - * @since 2024-06-28 - */ -class CommonPropHelperTest { - - @Test - @TmsLink("C11036") - void testCommaList() { - Assertions.assertTrue(CommonPropHelper.commaList("").isEmpty()); - Assertions.assertTrue(CommonPropHelper.commaList(",").isEmpty()); - Assertions.assertTrue(CommonPropHelper.commaList(",,").isEmpty()); - Assertions.assertEquals(List.of("1", "2"), CommonPropHelper.commaList("1,,2")); - Assertions.assertEquals(List.of("1", "2"), CommonPropHelper.commaList("1 , - , , 2 ")); - - Assertions.assertEquals(List.of(""), CommonPropHelper.commaList("", false, false)); - Assertions.assertEquals(List.of("", ""), CommonPropHelper.commaList(",", false, false)); - Assertions.assertEquals(List.of("", "", ""), CommonPropHelper.commaList(",,", false, false)); - Assertions.assertEquals(List.of("1", "", "2"), CommonPropHelper.commaList("1,,2", false, false)); - Assertions.assertEquals(List.of("1 ", " ", " 2 "), CommonPropHelper.commaList("1 , , 2 ", false, false)); - - Assertions.assertNull(CommonPropHelper.commaString((String[]) null)); - Assertions.assertEquals("", CommonPropHelper.commaString(List.of(""))); - Assertions.assertEquals(",", CommonPropHelper.commaString(List.of("",""))); - Assertions.assertEquals(",,1", CommonPropHelper.commaString(List.of("", "", "1"))); - Assertions.assertEquals(",,1 ", CommonPropHelper.commaString(List.of("", "", "1 "))); - Assertions.assertEquals(",,1 ,-", CommonPropHelper.commaString(List.of("", "", "1 ", "-"))); - - Assertions.assertEquals("", CommonPropHelper.commaString(List.of(""), true, true)); - Assertions.assertEquals("", CommonPropHelper.commaString(List.of("", ""), true, true)); - Assertions.assertEquals("1", CommonPropHelper.commaString(List.of("", "", "1"), true, true)); - Assertions.assertEquals("1", CommonPropHelper.commaString(List.of("", "", "1 "), true, true)); - Assertions.assertEquals("1", CommonPropHelper.commaString(List.of("", "", "1 ", "- "), true, true)); - Assertions.assertEquals("1 ,- ", CommonPropHelper.commaString(List.of("", "", "1 ", "- "), false, true)); - } -} \ No newline at end of file diff --git a/wings/silencer/src/test/resources/wings-conf/wings-merge-a.properties b/wings/silencer-curse/src/test/resources/wings-conf/wings-merge-a.properties similarity index 100% rename from wings/silencer/src/test/resources/wings-conf/wings-merge-a.properties rename to wings/silencer-curse/src/test/resources/wings-conf/wings-merge-a.properties diff --git a/wings/silencer/src/test/resources/wings-conf/wings-merge-b.properties b/wings/silencer-curse/src/test/resources/wings-conf/wings-merge-b.properties similarity index 100% rename from wings/silencer/src/test/resources/wings-conf/wings-merge-b.properties rename to wings/silencer-curse/src/test/resources/wings-conf/wings-merge-b.properties diff --git a/wings/silencer/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerConfiguration.java b/wings/silencer/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerConfiguration.java index ba668531b..43468a0d9 100644 --- a/wings/silencer/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerConfiguration.java +++ b/wings/silencer/src/main/java/pro/fessional/wings/silencer/spring/bean/SilencerConfiguration.java @@ -2,13 +2,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.context.ApplicationContext; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; -import pro.fessional.wings.silencer.enhance.ThisLazyPostProcessor; import pro.fessional.wings.silencer.message.MessageSourceHelper; import pro.fessional.wings.silencer.runner.ApplicationInspectRunner; import pro.fessional.wings.silencer.runner.ApplicationRunnerOrdered; @@ -38,14 +36,6 @@ public static WingsReorderProcessor wingsReorderProcessor() { return new WingsReorderProcessor(); } - - @Bean - @ConditionalWingsEnabled - public static BeanPostProcessor thisLazyAwarePostProcessor() { - log.info("Silencer spring-auto thisLazyAwarePostProcessor"); - return new ThisLazyPostProcessor(); - } - /** * @link Internationalization * @see org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration diff --git a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelper.java b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/InspectHelper.java similarity index 86% rename from wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelper.java rename to wings/silencer/src/main/java/pro/fessional/wings/silencer/support/InspectHelper.java index eb8132a67..19d438e97 100644 --- a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelper.java +++ b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/InspectHelper.java @@ -1,4 +1,4 @@ -package pro.fessional.wings.silencer.spring.help; +package pro.fessional.wings.silencer.support; import org.springframework.boot.info.GitProperties; @@ -6,14 +6,11 @@ import java.time.ZoneId; import java.time.ZonedDateTime; -import static pro.fessional.wings.silencer.datetime.DateTimePattern.FMT_DATE_10; -import static pro.fessional.wings.silencer.datetime.DateTimePattern.FMT_FULL_19Z; - /** * @author trydofor * @since 2024-06-03 */ -public class VersionInfoHelper { +public class InspectHelper { public static String jvmName() { return System.getProperty("java.vm.name"); @@ -67,12 +64,12 @@ public static String buildVersion(GitProperties git) { private static String toDatetime(Instant time) { if (time == null) return null; ZonedDateTime zdt = ZonedDateTime.ofInstant(time, ZoneId.systemDefault()); - return FMT_FULL_19Z.format(zdt); + return zdt.toString(); } private static String toDate(Instant time) { if (time == null) return null; ZonedDateTime zdt = ZonedDateTime.ofInstant(time, ZoneId.systemDefault()); - return FMT_DATE_10.format(zdt); + return zdt.toLocalDate().toString(); } } diff --git a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/CommonPropHelper.java b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/PropHelper.java similarity index 98% rename from wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/CommonPropHelper.java rename to wings/silencer/src/main/java/pro/fessional/wings/silencer/support/PropHelper.java index 59cd476cd..720d24df0 100644 --- a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/CommonPropHelper.java +++ b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/PropHelper.java @@ -1,4 +1,4 @@ -package pro.fessional.wings.silencer.spring.help; +package pro.fessional.wings.silencer.support; import lombok.SneakyThrows; import org.jetbrains.annotations.Contract; @@ -25,7 +25,7 @@ * @author trydofor * @since 2022-06-17 */ -public class CommonPropHelper { +public class PropHelper { public static final String DisabledValue = "-"; public static final String MaskingValue = "*****"; @@ -52,7 +52,7 @@ public static LinkedHashSet onlyValue(Collection values) { if (values == null) return new LinkedHashSet<>(); final LinkedHashSet set = new LinkedHashSet<>(values); - set.removeIf(CommonPropHelper::nonValue); + set.removeIf(PropHelper::nonValue); return set; } diff --git a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/SubclassSpringLoader.java b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/SubclassGather.java similarity index 95% rename from wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/SubclassSpringLoader.java rename to wings/silencer/src/main/java/pro/fessional/wings/silencer/support/SubclassGather.java index c047f1dc4..0aa231b68 100644 --- a/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/spring/help/SubclassSpringLoader.java +++ b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/SubclassGather.java @@ -1,4 +1,4 @@ -package pro.fessional.wings.silencer.spring.help; +package pro.fessional.wings.silencer.support; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; @@ -24,12 +24,12 @@ * @author trydofor * @since 2020-07-04 */ -public class SubclassSpringLoader { +public class SubclassGather { private final ResourcePatternResolver resourcePatternResolver; private final MetadataReaderFactory metadataReaderFactory; - public SubclassSpringLoader(ResourceLoader resourceLoader) { + public SubclassGather(ResourceLoader resourceLoader) { resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader); metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader); } diff --git a/wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/TypeSugar.java b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/TypeSugar.java similarity index 99% rename from wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/TypeSugar.java rename to wings/silencer/src/main/java/pro/fessional/wings/silencer/support/TypeSugar.java index f24e98014..200000a5a 100644 --- a/wings/silencer/src/main/java/pro/fessional/wings/silencer/enhance/TypeSugar.java +++ b/wings/silencer/src/main/java/pro/fessional/wings/silencer/support/TypeSugar.java @@ -1,4 +1,4 @@ -package pro.fessional.wings.silencer.enhance; +package pro.fessional.wings.silencer.support; import jakarta.annotation.Nullable; import lombok.SneakyThrows; diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/TestSilencerApplication.java b/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/TestSilencerApplication.java index 770765d04..0877aff41 100644 --- a/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/TestSilencerApplication.java +++ b/wings/silencer/src/test/java/pro/fessional/wings/silencer/app/TestSilencerApplication.java @@ -2,15 +2,12 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import pro.fessional.wings.silencer.app.conf.TestMergingProp; /** * @author trydofor * @since 2019-07-20 */ @SpringBootApplication -@EnableConfigurationProperties(TestMergingProp.class) public class TestSilencerApplication { public static void main(String[] args) { diff --git a/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelperTest.java b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/InspectHelperTest.java similarity index 58% rename from wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelperTest.java rename to wings/silencer/src/test/java/pro/fessional/wings/silencer/support/InspectHelperTest.java index 361dbc47e..d554a25e3 100644 --- a/wings/silencer-curse/src/test/java/pro/fessional/wings/silencer/spring/help/VersionInfoHelperTest.java +++ b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/InspectHelperTest.java @@ -1,4 +1,4 @@ -package pro.fessional.wings.silencer.spring.help; +package pro.fessional.wings.silencer.support; import io.qameta.allure.TmsLink; import lombok.Setter; @@ -17,7 +17,7 @@ */ @SpringBootTest @Slf4j -class VersionInfoHelperTest { +class InspectHelperTest { @Setter(onMethod_ = { @Autowired }) private BuildProperties buildProperties; @@ -34,7 +34,7 @@ public void infoBuildAndGit() { log.info("git={}", gitProperties); Assertions.assertEquals("pro.fessional.wings",buildProperties.getGroup()); - Assertions.assertEquals("silencer-curse",buildProperties.getArtifact()); + Assertions.assertEquals("silencer",buildProperties.getArtifact()); Assertions.assertNotNull(gitProperties.getBranch()); // spring use git.commit.id, need commitIdGenerationMode=flat, but wings use full Assertions.assertNull(gitProperties.getCommitId()); @@ -42,17 +42,17 @@ public void infoBuildAndGit() { Assertions.assertNotNull(gitProperties.getCommitTime()); // safe and format - Assertions.assertNotNull(VersionInfoHelper.jvmName()); - Assertions.assertNotNull(VersionInfoHelper.jvmVersion()); - Assertions.assertNotNull(VersionInfoHelper.jvmVendor()); - Assertions.assertNotNull(VersionInfoHelper.commitIdShort(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.commitId(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.commitDate(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.commitDateTime(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.commitMessage(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.branch(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.buildDate(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.buildDateTime(gitProperties)); - Assertions.assertNotNull(VersionInfoHelper.buildVersion(gitProperties)); + Assertions.assertNotNull(InspectHelper.jvmName()); + Assertions.assertNotNull(InspectHelper.jvmVersion()); + Assertions.assertNotNull(InspectHelper.jvmVendor()); + Assertions.assertNotNull(InspectHelper.commitIdShort(gitProperties)); + Assertions.assertNotNull(InspectHelper.commitId(gitProperties)); + Assertions.assertNotNull(InspectHelper.commitDate(gitProperties)); + Assertions.assertNotNull(InspectHelper.commitDateTime(gitProperties)); + Assertions.assertNotNull(InspectHelper.commitMessage(gitProperties)); + Assertions.assertNotNull(InspectHelper.branch(gitProperties)); + Assertions.assertNotNull(InspectHelper.buildDate(gitProperties)); + Assertions.assertNotNull(InspectHelper.buildDateTime(gitProperties)); + Assertions.assertNotNull(InspectHelper.buildVersion(gitProperties)); } } \ No newline at end of file diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/PropHelperTest.java b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/PropHelperTest.java new file mode 100644 index 000000000..3d761be55 --- /dev/null +++ b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/PropHelperTest.java @@ -0,0 +1,44 @@ +package pro.fessional.wings.silencer.support; + +import io.qameta.allure.TmsLink; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.List; + +/** + * @author trydofor + * @since 2024-06-28 + */ +class PropHelperTest { + + @Test + @TmsLink("C11036") + void testCommaList() { + Assertions.assertTrue(PropHelper.commaList("").isEmpty()); + Assertions.assertTrue(PropHelper.commaList(",").isEmpty()); + Assertions.assertTrue(PropHelper.commaList(",,").isEmpty()); + Assertions.assertEquals(List.of("1", "2"), PropHelper.commaList("1,,2")); + Assertions.assertEquals(List.of("1", "2"), PropHelper.commaList("1 , - , , 2 ")); + + Assertions.assertEquals(List.of(""), PropHelper.commaList("", false, false)); + Assertions.assertEquals(List.of("", ""), PropHelper.commaList(",", false, false)); + Assertions.assertEquals(List.of("", "", ""), PropHelper.commaList(",,", false, false)); + Assertions.assertEquals(List.of("1", "", "2"), PropHelper.commaList("1,,2", false, false)); + Assertions.assertEquals(List.of("1 ", " ", " 2 "), PropHelper.commaList("1 , , 2 ", false, false)); + + Assertions.assertNull(PropHelper.commaString((String[]) null)); + Assertions.assertEquals("", PropHelper.commaString(List.of(""))); + Assertions.assertEquals(",", PropHelper.commaString(List.of("",""))); + Assertions.assertEquals(",,1", PropHelper.commaString(List.of("", "", "1"))); + Assertions.assertEquals(",,1 ", PropHelper.commaString(List.of("", "", "1 "))); + Assertions.assertEquals(",,1 ,-", PropHelper.commaString(List.of("", "", "1 ", "-"))); + + Assertions.assertEquals("", PropHelper.commaString(List.of(""), true, true)); + Assertions.assertEquals("", PropHelper.commaString(List.of("", ""), true, true)); + Assertions.assertEquals("1", PropHelper.commaString(List.of("", "", "1"), true, true)); + Assertions.assertEquals("1", PropHelper.commaString(List.of("", "", "1 "), true, true)); + Assertions.assertEquals("1", PropHelper.commaString(List.of("", "", "1 ", "- "), true, true)); + Assertions.assertEquals("1 ,- ", PropHelper.commaString(List.of("", "", "1 ", "- "), false, true)); + } +} \ No newline at end of file diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/TypeSugarMain.java b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/TypeSugarMain.java similarity index 96% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/TypeSugarMain.java rename to wings/silencer/src/test/java/pro/fessional/wings/silencer/support/TypeSugarMain.java index bb12c9acc..e5bc1f527 100644 --- a/wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/TypeSugarMain.java +++ b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/TypeSugarMain.java @@ -1,4 +1,4 @@ -package pro.fessional.wings.silencer.enhance; +package pro.fessional.wings.silencer.support; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; @@ -11,6 +11,7 @@ import org.openjdk.jmh.annotations.Warmup; import org.springframework.core.ResolvableType; import org.springframework.core.convert.TypeDescriptor; +import pro.fessional.wings.silencer.support.TypeSugar; import java.io.IOException; import java.util.List; diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/TypeSugarTest.java b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/TypeSugarTest.java similarity index 81% rename from wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/TypeSugarTest.java rename to wings/silencer/src/test/java/pro/fessional/wings/silencer/support/TypeSugarTest.java index df6fd6df7..0799fe419 100644 --- a/wings/silencer/src/test/java/pro/fessional/wings/silencer/enhance/TypeSugarTest.java +++ b/wings/silencer/src/test/java/pro/fessional/wings/silencer/support/TypeSugarTest.java @@ -1,4 +1,4 @@ -package pro.fessional.wings.silencer.enhance; +package pro.fessional.wings.silencer.support; import io.qameta.allure.TmsLink; import lombok.extern.slf4j.Slf4j; @@ -7,7 +7,6 @@ import org.springframework.core.ResolvableType; import org.springframework.core.convert.TypeDescriptor; import pro.fessional.mirana.data.R; -import pro.fessional.wings.silencer.app.conf.TestMergingProp; import java.time.LocalDate; import java.util.List; @@ -21,21 +20,25 @@ @Slf4j public class TypeSugarTest { + public static class Inner { + + } + @Test @TmsLink("C11035") void test() throws ClassNotFoundException { // Map var a0 = ResolvableType.forClassWithGenerics(Map.class, - ResolvableType.forClass(String.class), - ResolvableType.forClassWithGenerics(List.class, Long[].class) + ResolvableType.forClass(String.class), + ResolvableType.forClassWithGenerics(List.class, Long[].class) ); var a1 = TypeSugar.resolve(Map.class, String.class, List.class, Long[].class); log.info("type a1={}", a1); var a2 = TypeDescriptor.map(Map.class, - TypeDescriptor.valueOf(String.class), - TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Long[].class)) + TypeDescriptor.valueOf(String.class), + TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Long[].class)) ); var a3 = TypeSugar.describe(Map.class, String.class, List.class, Long[].class); @@ -45,15 +48,15 @@ void test() throws ClassNotFoundException { // Map,String> var b0 = ResolvableType.forClassWithGenerics(Map.class, - ResolvableType.forClassWithGenerics(List.class, Long[].class), - ResolvableType.forClass(String.class) + ResolvableType.forClassWithGenerics(List.class, Long[].class), + ResolvableType.forClass(String.class) ); var b1 = TypeSugar.resolve(Map.class, List.class, Long[].class, String.class); log.info("type b1={}", b1); var b2 = TypeDescriptor.map(Map.class, - TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Long[].class)), - TypeDescriptor.valueOf(String.class) + TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Long[].class)), + TypeDescriptor.valueOf(String.class) ); var b3 = TypeSugar.describe(Map.class, List.class, Long[].class, String.class); @@ -63,19 +66,19 @@ void test() throws ClassNotFoundException { // Map>,String> var c0 = ResolvableType.forClassWithGenerics(Map.class, - ResolvableType.forClassWithGenerics(List.class, - ResolvableType.forClassWithGenerics(List.class, Long[].class) - ), - ResolvableType.forClass(String.class) + ResolvableType.forClassWithGenerics(List.class, + ResolvableType.forClassWithGenerics(List.class, Long[].class) + ), + ResolvableType.forClass(String.class) ); var c1 = TypeSugar.resolve(Map.class, List.class, List.class, Long[].class, String.class); log.info("type c1={}", c1); var c2 = TypeDescriptor.map(Map.class, - TypeDescriptor.collection(List.class, - TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Long[].class)) - ), - TypeDescriptor.valueOf(String.class) + TypeDescriptor.collection(List.class, + TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Long[].class)) + ), + TypeDescriptor.valueOf(String.class) ); var c3 = TypeSugar.describe(Map.class, List.class, List.class, Long[].class, String.class); @@ -117,7 +120,7 @@ void test() throws ClassNotFoundException { testStructs(b0); testStructs(c0); testStructs(d0); - testStructs(TypeSugar.resolve(R.class, TestMergingProp.Pojo.class)); + testStructs(TypeSugar.resolve(R.class, Inner.class)); testStructs(TypeSugar.resolve(R.class)); testStructs(TypeSugar.resolve(List.class)); testStructs(TypeSugar.resolve(Map.class)); diff --git a/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/servlet/cookie/impl/WingsCookieInterceptorImpl.java b/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/servlet/cookie/impl/WingsCookieInterceptorImpl.java index 8cf88d094..f8055379d 100644 --- a/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/servlet/cookie/impl/WingsCookieInterceptorImpl.java +++ b/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/servlet/cookie/impl/WingsCookieInterceptorImpl.java @@ -17,7 +17,7 @@ import java.util.Map; import java.util.Set; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.nonValue; +import static pro.fessional.wings.silencer.support.PropHelper.nonValue; /** * Designed for non-runtime tuning, so no write protection is provided. diff --git a/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarRemoteConfiguration.java b/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarRemoteConfiguration.java index 34a85889b..01e3c08b1 100644 --- a/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarRemoteConfiguration.java +++ b/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarRemoteConfiguration.java @@ -5,7 +5,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import pro.fessional.wings.silencer.spring.boot.ConditionalWingsEnabled; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import pro.fessional.wings.slardar.servlet.resolver.WingsRemoteResolver; import pro.fessional.wings.slardar.spring.prop.SlardarRemoteProp; @@ -24,9 +24,9 @@ public class SlardarRemoteConfiguration { public WingsRemoteResolver wingsRemoteResolver(SlardarRemoteProp conf) { log.info("SlardarWebmvc spring-bean wingsRemoteResolver"); final WingsRemoteResolver resolver = new WingsRemoteResolver(); - resolver.addInnerIp(CommonPropHelper.onlyValue(conf.getInnerIp().values())); - resolver.addAgentHeader(CommonPropHelper.onlyValue(conf.getAgentHeader().values())); - resolver.addIpHeader(CommonPropHelper.onlyValue(conf.getIpHeader().values())); + resolver.addInnerIp(PropHelper.onlyValue(conf.getInnerIp().values())); + resolver.addAgentHeader(PropHelper.onlyValue(conf.getAgentHeader().values())); + resolver.addIpHeader(PropHelper.onlyValue(conf.getIpHeader().values())); return resolver; } } diff --git a/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarSwaggerConfiguration.java b/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarSwaggerConfiguration.java index d98be1e5c..becc13061 100644 --- a/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarSwaggerConfiguration.java +++ b/wings/slardar-webmvc/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarSwaggerConfiguration.java @@ -20,7 +20,7 @@ import org.springframework.context.annotation.Configuration; import pro.fessional.mirana.page.PageQuery; import pro.fessional.wings.silencer.spring.boot.ConditionalWingsEnabled; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import pro.fessional.wings.slardar.spring.prop.SlardarEnabledProp; import pro.fessional.wings.slardar.spring.prop.SlardarPagequeryProp; import pro.fessional.wings.slardar.spring.prop.SlardarSwaggerProp; @@ -62,7 +62,7 @@ public OpenApiCustomizer slardarOpenApiCustomizer(SlardarSwaggerProp slardarSwag } final Map params = slardarSwaggerProp.toComPara(); - final Map accepts = CommonPropHelper.onlyValue(slardarSwaggerProp.getAccept()); + final Map accepts = PropHelper.onlyValue(slardarSwaggerProp.getAccept()); if (params.isEmpty() && accepts.isEmpty()) return; openApi.getPaths().values() diff --git a/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java b/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java index e77e854d5..19a67bdd4 100644 --- a/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java +++ b/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java @@ -58,7 +58,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.MaskingValue; +import static pro.fessional.wings.silencer.support.PropHelper.MaskingValue; import static pro.fessional.wings.slardar.context.TerminalAttribute.TerminalAddr; import static pro.fessional.wings.slardar.context.TerminalAttribute.TerminalAgent; diff --git a/wings/slardar/src/main/java/pro/fessional/wings/slardar/fastjson/FastJsonHelper.java b/wings/slardar/src/main/java/pro/fessional/wings/slardar/fastjson/FastJsonHelper.java index d390553ea..d40705121 100644 --- a/wings/slardar/src/main/java/pro/fessional/wings/slardar/fastjson/FastJsonHelper.java +++ b/wings/slardar/src/main/java/pro/fessional/wings/slardar/fastjson/FastJsonHelper.java @@ -11,7 +11,7 @@ import org.springframework.core.ResolvableType; import org.springframework.core.convert.TypeDescriptor; import pro.fessional.mirana.lock.ArrayKey; -import pro.fessional.wings.silencer.enhance.TypeSugar; +import pro.fessional.wings.silencer.support.TypeSugar; import java.io.InputStream; import java.lang.reflect.Type; diff --git a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringDeserializer.java b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringDeserializer.java index 31f59460a..ea7fc78b9 100644 --- a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringDeserializer.java +++ b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringDeserializer.java @@ -15,7 +15,7 @@ import java.io.IOException; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.MaskingValue; +import static pro.fessional.wings.silencer.support.PropHelper.MaskingValue; /** * @author trydofor diff --git a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringSerializer.java b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringSerializer.java index 4c117f744..817efcf0d 100644 --- a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringSerializer.java +++ b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/AesStringSerializer.java @@ -14,7 +14,7 @@ import java.io.IOException; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.MaskingValue; +import static pro.fessional.wings.silencer.support.PropHelper.MaskingValue; /** diff --git a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/JacksonHelper.java b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/JacksonHelper.java index b226579a2..97dc507cb 100644 --- a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/JacksonHelper.java +++ b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/JacksonHelper.java @@ -16,7 +16,7 @@ import pro.fessional.mirana.text.WhiteUtil; import pro.fessional.mirana.time.DateFormatter; import pro.fessional.wings.silencer.datetime.DateTimePattern; -import pro.fessional.wings.silencer.enhance.TypeSugar; +import pro.fessional.wings.silencer.support.TypeSugar; import pro.fessional.wings.slardar.autozone.AutoZoneType; import pro.fessional.wings.slardar.autozone.json.JacksonLocalDateTimeDeserializer; import pro.fessional.wings.slardar.autozone.json.JacksonLocalDateTimeSerializer; diff --git a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/ResourceSerializer.java b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/ResourceSerializer.java index 335647925..606020035 100644 --- a/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/ResourceSerializer.java +++ b/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/ResourceSerializer.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import org.springframework.core.io.Resource; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import java.io.IOException; @@ -15,7 +15,7 @@ public class ResourceSerializer extends JsonSerializer { @Override public void serialize(Resource value, JsonGenerator gen, SerializerProvider serializers) throws IOException { - final String res = CommonPropHelper.stringResource(value); + final String res = PropHelper.stringResource(value); gen.writeString(res); } } diff --git a/wings/slardar/src/main/java/pro/fessional/wings/slardar/notice/DingTalkConf.java b/wings/slardar/src/main/java/pro/fessional/wings/slardar/notice/DingTalkConf.java index e77068e70..f475e0702 100644 --- a/wings/slardar/src/main/java/pro/fessional/wings/slardar/notice/DingTalkConf.java +++ b/wings/slardar/src/main/java/pro/fessional/wings/slardar/notice/DingTalkConf.java @@ -9,8 +9,8 @@ import java.util.HashMap; import java.util.Map; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.mergeIfNon; -import static pro.fessional.wings.silencer.spring.help.CommonPropHelper.nonValue; +import static pro.fessional.wings.silencer.support.PropHelper.mergeIfNon; +import static pro.fessional.wings.silencer.support.PropHelper.nonValue; /** * @author trydofor diff --git a/wings/slardar/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarMonitorConfiguration.java b/wings/slardar/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarMonitorConfiguration.java index 21a8024e5..54e1aa9f3 100644 --- a/wings/slardar/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarMonitorConfiguration.java +++ b/wings/slardar/src/main/java/pro/fessional/wings/slardar/spring/bean/SlardarMonitorConfiguration.java @@ -27,9 +27,9 @@ import java.io.File; import java.util.Map; -import static pro.fessional.wings.silencer.spring.help.VersionInfoHelper.branch; -import static pro.fessional.wings.silencer.spring.help.VersionInfoHelper.buildDate; -import static pro.fessional.wings.silencer.spring.help.VersionInfoHelper.commitIdShort; +import static pro.fessional.wings.silencer.support.InspectHelper.branch; +import static pro.fessional.wings.silencer.support.InspectHelper.buildDate; +import static pro.fessional.wings.silencer.support.InspectHelper.commitIdShort; /** * @author trydofor diff --git a/wings/slardar/src/test/java/pro/fessional/wings/slardar/json/TypeReferenceTest.java b/wings/slardar/src/test/java/pro/fessional/wings/slardar/json/TypeReferenceTest.java index 188430efd..b6237da34 100644 --- a/wings/slardar/src/test/java/pro/fessional/wings/slardar/json/TypeReferenceTest.java +++ b/wings/slardar/src/test/java/pro/fessional/wings/slardar/json/TypeReferenceTest.java @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test; import org.springframework.core.ResolvableType; import org.springframework.core.convert.TypeDescriptor; -import pro.fessional.wings.silencer.enhance.TypeSugar; +import pro.fessional.wings.silencer.support.TypeSugar; import java.lang.reflect.Type; import java.util.List; diff --git a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/security/justauth/AuthStateBuilder.java b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/security/justauth/AuthStateBuilder.java index 0eb40daea..a1bc2f868 100644 --- a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/security/justauth/AuthStateBuilder.java +++ b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/security/justauth/AuthStateBuilder.java @@ -11,7 +11,7 @@ import pro.fessional.mirana.code.RandCode; import pro.fessional.mirana.data.Null; import pro.fessional.mirana.text.FormatUtil; -import pro.fessional.wings.silencer.enhance.TypeSugar; +import pro.fessional.wings.silencer.support.TypeSugar; import pro.fessional.wings.slardar.fastjson.FastJsonHelper; import pro.fessional.wings.slardar.security.WingsAuthHelper; import pro.fessional.wings.slardar.servlet.request.RequestHelper; diff --git a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityBeanConfiguration.java b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityBeanConfiguration.java index 8364792b9..332dbf1c6 100644 --- a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityBeanConfiguration.java +++ b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityBeanConfiguration.java @@ -18,7 +18,7 @@ import pro.fessional.mirana.bits.Aes; import pro.fessional.wings.silencer.spring.WingsOrdered; import pro.fessional.wings.silencer.spring.boot.ConditionalWingsEnabled; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import pro.fessional.wings.slardar.cache.WingsCache; import pro.fessional.wings.slardar.security.WingsAuthDetailsSource; import pro.fessional.wings.slardar.security.WingsAuthPageHandler; @@ -393,7 +393,7 @@ public WingsAuthDetailsSource wingsAuthDetailsSource(ObjectProvider aesProvider) { log.info("WarlockShadow spring-bean authStateBuilder"); - final AuthStateBuilder bean = new AuthStateBuilder(CommonPropHelper.onlyValue(prop.getSafeState())); + final AuthStateBuilder bean = new AuthStateBuilder(PropHelper.onlyValue(prop.getSafeState())); final Aes aes = aesProvider.getIfAvailable(); if (aes != null) { bean.setAes(aes); diff --git a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityConfConfiguration.java b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityConfConfiguration.java index 566061ca1..aa3122363 100644 --- a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityConfConfiguration.java +++ b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/bean/WarlockSecurityConfConfiguration.java @@ -29,7 +29,7 @@ import pro.fessional.wings.silencer.runner.ApplicationRunnerOrdered; import pro.fessional.wings.silencer.spring.WingsOrdered; import pro.fessional.wings.silencer.spring.boot.ConditionalWingsEnabled; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import pro.fessional.wings.slardar.security.WingsAuthDetailsSource; import pro.fessional.wings.slardar.servlet.request.FakeHttpServletRequest; import pro.fessional.wings.slardar.servlet.response.ResponseHelper; @@ -72,7 +72,7 @@ public WebSecurityCustomizer warlockWebCustomizer(WarlockSecurityProp securityPr // https://github.com/spring-projects/spring-security/issues/10938 final Map webIgnore = securityProp.getWebIgnore(); if (!webIgnore.isEmpty()) { - final Set ignores = CommonPropHelper.onlyValue(webIgnore.values()); + final Set ignores = PropHelper.onlyValue(webIgnore.values()); log.info("WarlockShadow conf WebSecurity, ignoring=" + String.join("\n,", ignores)); web.ignoring().requestMatchers(ignores.toArray(String[]::new)); } @@ -168,14 +168,14 @@ public HttpSecurityCustomizer warlockSecurityAuthHttpConfigure(WarlockSecurityPr return http -> http.authorizeHttpRequests(conf -> { // 1 PermitAll - final Set permed = CommonPropHelper.onlyValue(securityProp.getPermitAll().values()); + final Set permed = PropHelper.onlyValue(securityProp.getPermitAll().values()); if (!permed.isEmpty()) { log.info("WarlockShadow conf HttpSecurity, bind PermitAll=" + String.join("\n,", permed)); conf.requestMatchers(permed.toArray(String[]::new)).permitAll(); } // 2 Authenticated - final Set authed = CommonPropHelper.onlyValue(securityProp.getAuthenticated().values()); + final Set authed = PropHelper.onlyValue(securityProp.getAuthenticated().values()); if (!authed.isEmpty()) { log.info("WarlockShadow conf HttpSecurity, bind Authenticated=" + String.join("\n,", authed)); conf.requestMatchers(authed.toArray(String[]::new)).authenticated(); @@ -188,7 +188,7 @@ public HttpSecurityCustomizer warlockSecurityAuthHttpConfigure(WarlockSecurityPr for (Map.Entry> en : securityProp.getAuthority().entrySet()) { final String perm = en.getKey(); for (String url : en.getValue()) { - if (CommonPropHelper.hasValue(url)) { + if (PropHelper.hasValue(url)) { final Set st = urlPerm.computeIfAbsent(url, k -> new HashSet<>()); st.add(perm); } @@ -197,7 +197,7 @@ public HttpSecurityCustomizer warlockSecurityAuthHttpConfigure(WarlockSecurityPr // desc for (Map.Entry> en : urlPerm.descendingMap().entrySet()) { final String url = en.getKey(); - final Set pms = CommonPropHelper.onlyValue(en.getValue()); + final Set pms = PropHelper.onlyValue(en.getValue()); log.info("WarlockShadow conf HttpSecurity, bind url=" + url + ", any-permit=[" + String.join(",", pms) + "]"); conf.requestMatchers(url).hasAnyAuthority(pms.toArray(Null.StrArr)); } diff --git a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/prop/WarlockSecurityProp.java b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/prop/WarlockSecurityProp.java index b77437f16..a342c29be 100644 --- a/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/prop/WarlockSecurityProp.java +++ b/wings/warlock-shadow/src/main/java/pro/fessional/wings/warlock/spring/prop/WarlockSecurityProp.java @@ -2,7 +2,7 @@ import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; -import pro.fessional.wings.silencer.spring.help.CommonPropHelper; +import pro.fessional.wings.silencer.support.PropHelper; import pro.fessional.wings.slardar.context.TerminalContext; import pro.fessional.wings.warlock.enums.autogen.UserStatus; @@ -386,7 +386,7 @@ public Enum mapAuthTypeDefault() { public Map> mapAuthTypeEnum() { return authType.entrySet() .stream() - .filter(it -> CommonPropHelper.hasValue(it.getValue())) + .filter(it -> PropHelper.hasValue(it.getValue())) .collect(toMap(Map.Entry::getKey, en -> str2Enum(en.getValue()))); } diff --git a/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/RuntimeConfService.java b/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/RuntimeConfService.java index e3fa345a3..4b779111f 100644 --- a/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/RuntimeConfService.java +++ b/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/RuntimeConfService.java @@ -4,7 +4,7 @@ import org.springframework.core.ResolvableType; import org.springframework.core.convert.TypeDescriptor; import pro.fessional.mirana.cast.EnumConvertor; -import pro.fessional.wings.silencer.enhance.TypeSugar; +import pro.fessional.wings.silencer.support.TypeSugar; import java.util.List; import java.util.Map; diff --git a/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/impl/RuntimeConfServiceImpl.java b/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/impl/RuntimeConfServiceImpl.java index 9c63b6926..a41e231a4 100644 --- a/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/impl/RuntimeConfServiceImpl.java +++ b/wings/warlock/src/main/java/pro/fessional/wings/warlock/service/conf/impl/RuntimeConfServiceImpl.java @@ -18,7 +18,7 @@ import pro.fessional.wings.faceless.database.WingsTableCudHandler; import pro.fessional.wings.faceless.database.WingsTableCudHandler.Cud; import pro.fessional.wings.silencer.enhance.ThisLazy; -import pro.fessional.wings.silencer.enhance.TypeSugar; +import pro.fessional.wings.silencer.support.TypeSugar; import pro.fessional.wings.warlock.caching.CacheEventHelper; import pro.fessional.wings.warlock.database.autogen.tables.WinConfRuntimeTable; import pro.fessional.wings.warlock.database.autogen.tables.daos.WinConfRuntimeDao; diff --git a/wings/warlock/src/test/java/pro/fessional/wings/warlock/service/conf/RuntimeConfServiceTest.java b/wings/warlock/src/test/java/pro/fessional/wings/warlock/service/conf/RuntimeConfServiceTest.java index 3815e7be1..19b3d0016 100644 --- a/wings/warlock/src/test/java/pro/fessional/wings/warlock/service/conf/RuntimeConfServiceTest.java +++ b/wings/warlock/src/test/java/pro/fessional/wings/warlock/service/conf/RuntimeConfServiceTest.java @@ -11,7 +11,7 @@ import org.springframework.cache.CacheManager; import org.springframework.context.ApplicationContext; import pro.fessional.mirana.time.Sleep; -import pro.fessional.wings.silencer.enhance.TypeSugar; +import pro.fessional.wings.silencer.support.TypeSugar; import pro.fessional.wings.silencer.modulate.RunMode; import pro.fessional.wings.slardar.cache.SimpleCacheTemplate; import pro.fessional.wings.slardar.cache.WingsCacheHelper;