GH-936 - Detect methods (meta-)annotated with @MessageMapping as module entry points.

We now consider all methods that are (meta-)annotated with Spring Messaging's @MessageMapping which is consistently used in a lot of broker annotations such as @(Rabbit|Kafka)Listener etc.
This commit is contained in:
Oliver Drotbohm
2024-11-18 20:01:04 +01:00
parent a199bfcd64
commit 4218dffc9d
6 changed files with 116 additions and 8 deletions

View File

@@ -38,13 +38,24 @@ import com.tngtech.archunit.core.domain.JavaMethod;
import com.tngtech.archunit.lang.ArchRule;
/**
* Utility to deal with a variety of types.
*
* @author Oliver Drotbohm
*/
class Types {
public class Types {
/**
* Loads the class with the given name if present on the classpath.
*
* @param <T> the type to be loaded
* @param name the fully-qualified name of the type to be loaded, must not be {@literal null} or empty.
* @return can be {@literal null}.
*/
@Nullable
@SuppressWarnings("unchecked")
static <T> Class<T> loadIfPresent(String name) {
public static <T> Class<T> loadIfPresent(String name) {
Assert.hasText(name, "Name must not be null or empty!");
ClassLoader loader = Types.class.getClassLoader();