我正在尝试在spring-integration中转换xml配置,并且遇到了类似这样的过滤器:
<
int:filter
expression="someFilterExpression"
input-channel="inputChannel"
output-channel="outputChannel"
discard-channel="discardChannel"
/>
有没有办法为此提供与Java等效的注释?我尝试使用@Filter批注,但其中未包含表达式字段。
答案 0 :(得分:3)
我不确定我是否完全理解您的问题。如果您使用的是注释,则其全部原因是因为您具有不能或不应该用SpEL表示的一些复杂逻辑,因此它为您提供了编写一些Java代码的机会,并让框架知道这是一个过滤器。 还有DSL,我认为这篇文章涵盖得很好-spring integration dsl filter instead filter method annotation
答案 1 :(得分:1)
感谢您指出正确的方向。详细说明我做了什么。我放入spring集成dsl依赖项
<Coverflow width="960" height="500"
displayQuantityOfSide={2}
navigation={false}
enableScroll={true}
clickable={true}
active={0}
>
<div
onClick={() => fn()}
onKeyDown={() => fn()}
role="menuitem"
tabIndex="0"
>
<img
src='image/path'
alt='title or description'
style={{
display: 'block',
width: '100%',
}}
/>
</div>
<img src='image/path' alt='title or description' data-action="http://andyyou.github.io/react-coverflow/"/>
<img src='image/path' alt='title or description' data-action="http://andyyou.github.io/react-coverflow/"/>
</Coverflow>
,并使用IntegrationFlows构建过滤器。我是通过以下方式做到的:
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-java-dsl</artifactId>
<version>1.2.3.RELEASE</version>
</dependency>
因此,上述Java DSL基本上与以下内容相同:
@Bean
public IntegrationFlow filter() {
return IntegrationFlows
.from("someInputChannel")
.filter(
"someFilterExpression",
e -> e.discardChannel("someDiscardChannel"))
.channel("someOutputChannel")
.get();
}
非常感谢您的回答。 :)