-
Notifications
You must be signed in to change notification settings - Fork 628
Open
Labels
Description
For Stream binder there for support for the javax validation:
d93f170
But it seams for the functional interface it is gone.
It would expect this throwing a error when a message with invalid person name was received instead calling the log() method.
@SpringBootApplication
public class LoggingConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(LoggingConsumerApplication.class, args);
}
@Bean
public Consumer<Message<@Valid Person>> log() {
return msg -> {
System.out.println("Received: " + msg.getPayload());
};
}
public static class Person {
private String name;
public String getName() {
return name;
}
@Pattern(regexp = "^[a-zA-Z_:][a-zA-Z0-9_:]*$")
public void setName(String name) {
this.name = name;
}
public String toString() {
return this.name;
}
}
}
poznachowski