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