Ulhas N
Ulhas N

Reputation: 336

How to put “new line” in Spring Expression Language?

What would be the exact SpEL expression to go to the new line. Here is my configuration:

 <logging-channel-adapter id="log"
    channel="loggingChannel" level="INFO" 
    expression="'DealId: '+ payload.dealId \n + 'Name: '+ payload.name" />

Upvotes: 2

Views: 3366

Answers (2)

magulla
magulla

Reputation: 509

expression="'DealId: '+ payload.dealId'+  T(System).lineSeparator()+.......'"

Upvotes: 0

Gary Russell
Gary Russell

Reputation: 174514

You can use this as a work-around:

<int:logging-channel-adapter id="loggingChannel" logger-name="tapInbound"
    expression="'DealId: '+ payload.dealId + T(System).getProperty('line.separator') + 'Name: '+ payload.name"
    level="INFO" />

EDIT:

Just to clarify, SpEL supports escape characters, the problem is the java DOM parser doesn't understand escapes.

This works too...

expression="'DealId: '+ payload.dealId + '&#10;Name: '+ payload.name"

Upvotes: 3

Related Questions