本文整理了Java中org.springframework.messaging.handler.annotation.Payload
类的一些代码示例,展示了Payload
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Payload
类的具体详情如下:
包路径:org.springframework.messaging.handler.annotation.Payload
类名称:Payload
暂无
代码示例来源:origin: spring-projects/spring-integration-samples
/**
* Find the description for a provided coffee beverage.
*
* @return Collection of coffee beverages
*/
@Payload("new java.util.Date()")
List<CoffeeBeverage> findAllCoffeeBeverages();
代码示例来源:origin: spring-projects/spring-framework
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
Payload ann = parameter.getParameterAnnotation(Payload.class);
if (ann != null && StringUtils.hasText(ann.expression())) {
throw new IllegalStateException("@Payload SpEL expressions not supported by this resolver");
if (ann == null || ann.required()) {
String paramName = getParameterName(parameter);
BindingResult bindingResult = new BeanPropertyBindingResult(payload, paramName);
代码示例来源:origin: spring-projects/spring-integration
@Override
public boolean supportsParameter(MethodParameter parameter) {
Payload ann = parameter.getParameterAnnotation(Payload.class);
return ann != null && StringUtils.hasText(ann.expression());
}
代码示例来源:origin: ch.rasc/wampspring
throws Exception {
Payload ann = param.getParameterAnnotation(Payload.class);
if (ann != null && StringUtils.hasText(ann.value())) {
throw new IllegalStateException(
"@Payload SpEL expressions not supported by this resolver");
if (ann == null || ann.required()) {
String paramName = getParameterName(param);
BindingResult bindingResult = new BeanPropertyBindingResult(payload,
代码示例来源:origin: spring-projects/spring-integration
@Override
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
Expression expression = this.expressionCache.get(parameter);
if (expression == null) {
Payload ann = parameter.getParameterAnnotation(Payload.class);
expression = EXPRESSION_PARSER.parseExpression(ann.expression()); // NOSONAR never null - supportsParameter()
this.expressionCache.put(parameter, expression);
}
return evaluateExpression(expression, message.getPayload(), parameter.getParameterType());
}
代码示例来源:origin: spring-projects/spring-integration-samples
/**
* Find the description for a provided coffee beverage.
*
* @return Collection of coffee beverages
*/
@Payload("new java.util.Date()")
List<CoffeeBeverage> findAllCoffeeBeverages();
代码示例来源:origin: org.springframework/spring-messaging
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
Payload ann = parameter.getParameterAnnotation(Payload.class);
if (ann != null && StringUtils.hasText(ann.expression())) {
throw new IllegalStateException("@Payload SpEL expressions not supported by this resolver");
if (ann == null || ann.required()) {
String paramName = getParameterName(parameter);
BindingResult bindingResult = new BeanPropertyBindingResult(payload, paramName);
代码示例来源:origin: org.springframework.integration/spring-integration-core
@Override
public boolean supportsParameter(MethodParameter parameter) {
Payload ann = parameter.getParameterAnnotation(Payload.class);
return ann != null && StringUtils.hasText(ann.expression());
}
代码示例来源:origin: spring-projects/spring-integration-samples
/**
* Find the description for a provided coffee beverage.
*
* @return Collection of coffee beverages
*/
@Payload("new java.util.Date()")
List<CoffeeBeverage> findAllCoffeeBeverages();
代码示例来源:origin: spring-cloud/spring-cloud-stream
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
Payload ann = parameter.getParameterAnnotation(Payload.class);
if (ann != null && StringUtils.hasText(ann.expression())) {
throw new IllegalStateException("@Payload SpEL expressions not supported by this resolver");
if (ann == null || ann.required()) {
String paramName = getParameterName(parameter);
BindingResult bindingResult = new BeanPropertyBindingResult(payload, paramName);
代码示例来源:origin: org.springframework.integration/spring-integration-core
@Override
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
Expression expression = this.expressionCache.get(parameter);
if (expression == null) {
Payload ann = parameter.getParameterAnnotation(Payload.class);
expression = EXPRESSION_PARSER.parseExpression(ann.expression()); // NOSONAR never null - supportsParameter()
this.expressionCache.put(parameter, expression);
}
return evaluateExpression(expression, message.getPayload(), parameter.getParameterType());
}
代码示例来源:origin: spring-projects/spring-framework
@SuppressWarnings("unused")
private void handleMessage(
@Payload String param,
@Payload(required=false) String paramNotRequired,
@Payload(required=true) Locale nonConvertibleRequiredParam,
@Payload("foo.bar") String paramWithSpelExpression,
@MyValid @Payload String validParam,
@Validated String validParamNotAnnotated,
String paramNotAnnotated) {
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-messaging
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
Payload ann = parameter.getParameterAnnotation(Payload.class);
if (ann != null && StringUtils.hasText(ann.expression())) {
throw new IllegalStateException("@Payload SpEL expressions not supported by this resolver");
if (ann == null || ann.required()) {
String paramName = getParameterName(parameter);
BindingResult bindingResult = new BeanPropertyBindingResult(payload, paramName);
代码示例来源:origin: spring-projects/spring-framework
public String processAndReply(@Payload String content) {
this.invocations.put("processAndReply", true);
return content;
}
代码示例来源:origin: spring-projects/spring-framework
public void invalidPayloadType(@Payload Integer payload) {
throw new IllegalStateException("Should never be called.");
}
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
@StreamListener("input3")
public void receiveInput3(@Payload Foo foo) {
System.out.println("input3 receive: " + foo);
}
代码示例来源:origin: spring-projects/spring-framework
public void payloadValidation(@Payload @Validated String value) {
invocations.put("payloadValidation", true);
}
代码示例来源:origin: spring-projects/spring-framework
@MessageMapping("/validation/payload")
public void payloadValidation(@Validated @Payload String payload) {
this.method = "payloadValidation";
this.arguments.put("message", payload);
}
代码示例来源:origin: spring-projects/spring-framework
void handleIt(@Payload String msg, @Header("my-header") String myHeader);
}
代码示例来源:origin: spring-projects/spring-framework
public void handleIt(@Payload String msg, @Header("my-header") String myHeader) {
invocations.put("handleIt", true);
assertEquals("Unexpected payload message", "FOO-BAR", msg);
assertEquals("Unexpected header value", "my-value", myHeader);
}
}
内容来源于网络,如有侵权,请联系作者删除!