From c8421582765b5efb4973b43c69f21d318b0ac2ea Mon Sep 17 00:00:00 2001 From: Mingliang Wang Date: Wed, 20 Oct 2021 15:10:09 +0800 Subject: [PATCH] Preloading reports error in eclipse --- .../lib/legacy/function/handlers/AnnotationHandlerImpl.java | 6 +++--- .../microsoft/azure/toolkit/lib/common/cache/Preloader.java | 4 ++-- azure-toolkit-libs/pom.xml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/legacy/function/handlers/AnnotationHandlerImpl.java b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/legacy/function/handlers/AnnotationHandlerImpl.java index 3280a84bc..75004d76f 100644 --- a/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/legacy/function/handlers/AnnotationHandlerImpl.java +++ b/azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/legacy/function/handlers/AnnotationHandlerImpl.java @@ -18,7 +18,7 @@ import com.microsoft.azure.toolkit.lib.legacy.function.configurations.Retry; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.reflections.Reflections; -import org.reflections.scanners.MethodAnnotationsScanner; +import org.reflections.scanners.Scanners; import org.reflections.util.ConfigurationBuilder; import java.lang.annotation.Annotation; @@ -47,8 +47,8 @@ public class AnnotationHandlerImpl implements AnnotationHandler { return new Reflections( new ConfigurationBuilder() .addUrls(urls) - .setScanners(new MethodAnnotationsScanner()) - .addClassLoader(getClassLoader(urls))) + .setScanners(Scanners.MethodsAnnotated) + .addClassLoaders(getClassLoader(urls))) .getMethodsAnnotatedWith(FunctionName.class); } diff --git a/azure-toolkit-libs/azure-toolkit-common-lib/src/main/java/com/microsoft/azure/toolkit/lib/common/cache/Preloader.java b/azure-toolkit-libs/azure-toolkit-common-lib/src/main/java/com/microsoft/azure/toolkit/lib/common/cache/Preloader.java index 9b59f9bbd..25f6d90b0 100644 --- a/azure-toolkit-libs/azure-toolkit-common-lib/src/main/java/com/microsoft/azure/toolkit/lib/common/cache/Preloader.java +++ b/azure-toolkit-libs/azure-toolkit-common-lib/src/main/java/com/microsoft/azure/toolkit/lib/common/cache/Preloader.java @@ -9,7 +9,7 @@ import com.microsoft.azure.toolkit.lib.Azure; import com.microsoft.azure.toolkit.lib.AzureService; import lombok.extern.java.Log; import org.reflections.Reflections; -import org.reflections.scanners.MethodAnnotationsScanner; +import org.reflections.scanners.Scanners; import org.reflections.util.ConfigurationBuilder; import javax.annotation.Nullable; @@ -90,7 +90,7 @@ public class Preloader { private static Set getPreloadingMethods() { final ConfigurationBuilder configuration = new ConfigurationBuilder() .forPackages("com.microsoft.azure.toolkit", "com.microsoft.azuretools") - .setScanners(new MethodAnnotationsScanner()); + .setScanners(Scanners.MethodsAnnotated); final Reflections reflections = new Reflections(configuration); return reflections.getMethodsAnnotatedWith(Preload.class); } diff --git a/azure-toolkit-libs/pom.xml b/azure-toolkit-libs/pom.xml index 233b181ab..fa94f8c10 100644 --- a/azure-toolkit-libs/pom.xml +++ b/azure-toolkit-libs/pom.xml @@ -117,7 +117,7 @@ 3.0.2 1.1.1 0.9.1 - 0.9.12 + 0.10.1 1.0.6 1.9.2 9.15