Class BeanDefinitionUtils

java.lang.Object
org.axonframework.extension.spring.BeanDefinitionUtils

@Internal public class BeanDefinitionUtils extends Object
Utility methods for working with Spring BeanDefinitions.
Since:
5.0.2
Author:
Allard Buijze
  • Method Details

    • extractPackageName

      @Nonnull public static String extractPackageName(@Nonnull org.springframework.beans.factory.config.BeanDefinition definition)
      Extracts the package name from the given bean definition's class name.

      This method attempts to determine the package name by examining the bean definition in the following order:

      1. The bean class name from BeanDefinition.getBeanClassName()
      2. For AbstractBeanDefinition, the bean class if available
      3. For AnnotatedBeanDefinition, the metadata class name
      If a class name is found and contains a package (has a dot), returns the package portion. Otherwise, returns "default".
      Parameters:
      definition - The bean definition to extract the package name from.
      Returns:
      The package name, or "default" if the package cannot be determined.
    • resolveClassName

      @Nonnull public static Optional<String> resolveClassName(@Nonnull org.springframework.beans.factory.config.BeanDefinition definition)
      Resolves the fully qualified class name from a bean definition.

      Attempts multiple strategies to obtain the class name, returning the first non-null value.

      Parameters:
      definition - The bean definition to resolve the class name from.
      Returns:
      An Optional containing the fully qualified class name, or empty if it cannot be determined.