Advising Endpoints Using Annotations
通过使用注释(@Filter
、@ServiceActivator
、@Splitter
和 @Transformer
)配置某些端点时,你可以在 adviceChain
属性中为通知链提供 bean 名称。此外,@Filter
注释还具有 discardWithinAdvice
属性,该属性可用于配置丢弃行为,如 Advising Filters 中所讨论的。以下示例导致在通知之后执行丢弃:
When configuring certain endpoints by using annotations (@Filter
, @ServiceActivator
, @Splitter
, and @Transformer
), you can supply a bean name for the advice chain in the adviceChain
attribute.
In addition, the @Filter
annotation also has the discardWithinAdvice
attribute, which can be used to configure the discard behavior, as discussed in Advising Filters.
The following example causes the discard to be performed after the advice:
@MessageEndpoint
public class MyAdvisedFilter {
@Filter(inputChannel="input", outputChannel="output",
adviceChain="adviceChain", discardWithinAdvice="false")
public boolean filter(String s) {
return s.contains("good");
}
}