Annotation Interface Namespace


@Retention(RUNTIME) @Target({TYPE,PACKAGE,MODULE,ANNOTATION_TYPE}) public @interface Namespace
Annotation used to declare the namespace (or bounded context) of a class, package, or module.

The namespace value is used, for example, to derive the QualifiedName.namespace() field when a QualifiedName is constructed by annotation-resolving components. Because this annotation can be applied to packages and modules, it provides a single location to configure the namespace for many classes at once.

This is particularly useful when messages within a package or module share the same namespace. As such, this annotation acts as a catch-all alternative to the type-specific Command.namespace(), Event.namespace(), and Query.namespace() annotations.

Example usage on a class:


 @Namespace("university")
 public record SubscribeStudentToCourse(...) { }
 

Example usage on a package (in package-info.java):


 @Namespace("university")
 package org.axonframework.examples.university;

 import org.axonframework.messaging.core.annotation.Namespace;
 
Since:
5.1.0
Author:
Steven van Beelen
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The namespace (or bounded context) defined by this annotation.
  • Element Details

    • value

      String value
      The namespace (or bounded context) defined by this annotation.
      Returns:
      the namespace (or bounded context) defined by this annotation
      Default:
      ""