Class BannedArtifactClassLoadingExecutor


  • public class BannedArtifactClassLoadingExecutor
    extends java.lang.Object
    The executor for the banned artifacts that are loading by ClassLoader.

    The banned list should be defined at the config resource that locates on the "META-INF/banned-artifacts" was loaded by ClassLoader.

    The config resource format :

    ${groupId}:${artifactId}:${version}
    • groupId : Artifact Maven groupId
    • artifactId : Artifact Maven artifactId
    • version : Artifact Maven version

    Example Usage

    
     // Create a default instance and execute to remove banned artifacts from classpath
     BannedArtifactClassLoadingExecutor executor = new BannedArtifactClassLoadingExecutor();
     executor.execute();
     

    This will load all the banned artifact definitions from "META-INF/banned-artifacts" resources in the current classloader, detect all non-JDK artifacts in the classpath, and remove URLs corresponding to any matched banned artifacts.

    You can also provide a custom ClassLoader if you want to inspect a specific one:

    
     ClassLoader customClassLoader = ...; // your custom class loader
     BannedArtifactClassLoadingExecutor executor = new BannedArtifactClassLoadingExecutor(customClassLoader);
     executor.execute();
     
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    ArtifactDetector, MavenArtifact, Artifact
    • Field Detail

    • Constructor Detail

      • BannedArtifactClassLoadingExecutor

        public BannedArtifactClassLoadingExecutor()
      • BannedArtifactClassLoadingExecutor

        public BannedArtifactClassLoadingExecutor​(@Nullable
                                                  java.lang.ClassLoader classLoader)
    • Method Detail

      • execute

        public void execute()