import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface CustomAnnotation { String value(); } @CustomAnnotation("CustomConnector") public class CustomConnector { } import org.mule.api.annotations.lifecycle.Start; import org.mule.api.annotations.param.Connection; public class CustomConnector { @Start public void setupConnector(@Connection Object connection) { if (CustomConnector.class.isAnnotationPresent(CustomAnnotation.class)) { CustomAnnotation annotation = CustomConnector.class.getAnnotation(CustomAnnotation.class); String value = annotation.value(); System.out.println("Custom Annotation Value: " + value); } } } <module name="custom-module" doc:name="Custom Module"> <description>Custom Mule DevKit Module</description> <configurations> <configuration name="custom-connector-config" /> </configurations> <processors> <!-- Add processors here --> </processors> </module>


上一篇:
下一篇:
切换中文