spring-io / spring-javaformat

Apache License 2.0
795 stars 110 forks source link

Camel DSL routes with spring javaformat #386

Closed lfvdaniel closed 1 year ago

lfvdaniel commented 1 year ago

Hi,

I have a question about how to make spring javaformat to play nice with Apache Camel DSL.

Our team uses the project and for the most part it works fine, but when we do Apache Camel Routes with Camel DSL the result is not so good.

Below is an example of how I would like it to be formated:

from("direct:start")
    .choice()
        .when(body().contains("Camel"))
            .loadBalance().roundRobin()
                .to("mock:foo")
                .to("mock:bar")
    .endChoice()
    .otherwise()
        .to("mock:result");

After saving it looks like this.

from("direct:start").choice()
    .when(body().contains("Camel"))
    .loadBalance()
    .roundRobin()
    .to("mock:foo")
    .to("mock:bar")
    .endChoice()
    .otherwise()
    .to("mock:result");

How can this be fixed? Is there a way to select parts of the code not to format? Other suggestions?

BR /Daniel

snicoll commented 1 year ago

This is covered in the README.