ResourceProducer增加required属性
This commit is contained in:
@@ -1178,6 +1178,9 @@ public final class Application {
|
||||
throw new RestException("@" + ResourceProducer.class.getSimpleName() + " must on " + MessageProducer.class.getName() + " type field, but on " + field);
|
||||
}
|
||||
MessageAgent agent = findMessageAgent(annotation.mq());
|
||||
if (!annotation.required() && agent == null) {
|
||||
return;
|
||||
}
|
||||
if (agent == null) {
|
||||
throw new RedkaleException("Not found " + MessageAgent.class.getSimpleName() + "(name = " + annotation.mq() + ") on " + field);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
*/
|
||||
package org.redkale.mq;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.*;
|
||||
import org.redkale.convert.ConvertType;
|
||||
|
||||
/**
|
||||
@@ -25,6 +25,8 @@ public @interface ResourceProducer {
|
||||
|
||||
String mq();
|
||||
|
||||
boolean required() default true;
|
||||
|
||||
ConvertType convertType() default ConvertType.JSON;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user