Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This method then configures the component. The provider method is parameterized by the @Named("activemq.brokerURL") property which is injected from the jndi.properties file. This lets you define the properties which should be environment specific (such as URLs, machine names, usernames/passwords and so forth) while leaving all of the other configuration which does not change in different environments in Java code.

So you can dependency inject whatever objects you need to create, be it an Endpoint, Component, RouteBuilder or arbitrary bean used within a route. Then you can inject any properties from the jndi.properties file easily - so that most of your configuration is all in Java code which is typesafe and easily refactorable - then leaving some properties to be environment specific (the jndi.properties file) which you can then change based on development, testing, production etc.