2016-04-08 6 views
1

私は自分のコンテキストでこれらの定数を定義しました。ルータ式でutil定数を使用するには?

<util:constant id="foo1" static-field="com.marvel.avengers.hulc.util.MyExampleConstants.FOO1"/> 
<util:constant id="foo2" static-field="com.marvel.avengers.hulc.util.MyExampleConstants.FOO2"/> 
<util:constant id="foo3" static-field="com.marvel.avengers.hulc.util.MyExampleConstants.FOO3"/> 

ルーター式でfoo1定数を使用しようとしましたが、#{foo1}はその値ではなく、Bean IDです。一方

<int:router input-channel="channelABC" expression=" !payload.avengersVO.powType.equals(#{foo1}) 
     and !payload.avengersVO.powType.equals(#{foo2}) 
     and !payload.avengersVO.powType.equals(#{foo3}) ? 'flowEndpoint' : 'civilWarsChan'"/> 

私は式の中でこれを使用するが、私は、私は、ルータの式で定義した定数の使用を作ることができるかどうかを確認するためにしたいこと:

<int:router input-channel="channelABC" expression=" !payload.avengersVO.powType.equals(T(com.marvel.avengers.hulc.util.MyExampleConstants).FOO1) 
    and !payload.avengersVO.powType.equals(T(com.marvel.avengers.hulc.util.MyExampleConstants).FOO2) 
    and !payload.avengersVO.powType.equals(T(com.marvel.avengers.hulc.util.MyExampleConstants).FOO3) ? 'flowEndpoint' : 'civilWarsChan'"/> 

誰かが助けることができます私は知っている、どのようにルータ表現でこのbeanから価値を得るか。 ありがとうございます。

答えて

0

これは動作するはずです:あなたの場合は、あまりにも、罰金私のために見える、が

!payload.avengersVO.powType.equals(@foo2) 

は:

<util:constant id="foo" static-field="org.springframework.integration.router.config.RouterParserTests.FOO"/> 

<router input-channel="constantExpressionRouter" expression="'#{foo}'"/> 

しかし、私は避けるためにリテラル引用符の中にBean定義式をラップ注意を払います各メッセージの実行時にそれをプロパティとして評価しようとしました。

関連する問題