I have a Camel Spring Boot app whose application.properties file has the
line:
greeting=Hello.

Sure enough, a route with body set to {{greeting}} has a body of "Hello".

I'd like to handle a GET or POST to an endpoint by changing what is picked
up by {{greeting}}.  Various AIs tell me to use something along these lines:

 ((ConfigurableEnvironment)environment).getPropertySources()
   .addFirst(
     new MapPropertySource(
  "dynamicPropertySource",
  Collections.singletonMap("greeting", "NEW")
   )
     );
contextRefresher.refresh()

The environment and contextRefresher variables are autowired.  I use
control bus commands to stop and start the route, and put the
update/refresh in between.

No change in the output of {{greeting}} occurs.  I'm using Camel 4.4.1 and
Spring Boot 3.2.2.  I'm wondering, first of all, if what I'm showing should
work, as far as better eyes than mine can tell.  And, if not, what is the
correct way to update a route triggered from a timer so that properties can
be altered from how they were initially pulled in from
application.properties.

Any suggestions gratefully accepted.

Thanks,
Mitch

Reply via email to