Skip to content

Instantly share code, notes, and snippets.

@vackosar
Last active August 29, 2015 14:20
Show Gist options
  • Save vackosar/486e2b6b437f73abfe39 to your computer and use it in GitHub Desktop.
Save vackosar/486e2b6b437f73abfe39 to your computer and use it in GitHub Desktop.
DSL vs XML configuration
DSL configuration has all relevant information colocated on one place in the code.
XML configuration has information scattered. Part is in the XML and part in the code.
DSL CONFIGURATION EXAMPLE
.<OrderItem, Boolean>route(OrderItem::isIced, mapping -> mapping // 16
.subFlowMapping("true", routeIced())// 24
.subFlowMapping("false", routeNotIced()))
XML CONFIGURATION EXAMPLE
<int:router input-channel="drinks" ref="drinkRouter" method="resolveOrderItemChannel"/>
---
public class DrinkRouter {
public String resolveOrderItemChannel(OrderItem orderItem) {
return (orderItem.isIced()) ? "coldDrinks" : "hotDrinks";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment