Skip to content

io microsphere classloading BannedArtifactClassLoadingExecutor

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

BannedArtifactClassLoadingExecutor

Type: Class | Module: microsphere-java-core | Package: io.microsphere.classloading | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/classloading/BannedArtifactClassLoadingExecutor.java

Overview

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();
`

Declaration

public class BannedArtifactClassLoadingExecutor

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Example 1

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

Example 2

ClassLoader customClassLoader = ...; // your custom class loader
BannedArtifactClassLoadingExecutor executor = new BannedArtifactClassLoadingExecutor(customClassLoader);
executor.execute();

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.classloading.BannedArtifactClassLoadingExecutor;

API Reference

Public Methods

Method Description
execute

See Also

  • ArtifactDetector
  • MavenArtifact
  • Artifact

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally