in main/src/main/java/org/apache/camel/example/StandaloneCamel.java [35:59]
public static void main(String[] args) throws Exception {
// create a new CamelContext
try (CamelContext camelContext = new DefaultCamelContext()) {
// configure where to load properties file in the properties component
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
// resolve property placeholder
String hello = camelContext.resolvePropertyPlaceholders("{{hi}}");
// and create bean with the placeholder
MyBean myBean = new MyBean(hello);
// register bean to Camel
camelContext.getRegistry().bind("myBean", myBean);
// add routes to Camel
camelContext.addRoutes(new MyRouteBuilder());
// start Camel
camelContext.start();
// just run for 10 seconds and stop
System.out.println("Running for 10 seconds and then stopping");
Thread.sleep(10000);
}
}