Axon-spring-boot-starter / token / servers

Hi all,

We are facing an “issue” with the axon-spring-boot-starter to configure the token and servers properties.

All examples refer to set:

axon:
  axonserver:
    servers:
    context:
    token:

On our side we can’t set the servers and token keys because their values are unknown before the application deployment.

I will avoid to flood with unnecessary details but we are using a service catalog that will auto register the application in Axon and push some secret (servers and token) inside a kubernetes secret kind.
This secret is mounted in the application in a specific path.

So this is where we have the problem. Devs are not able to find a way to inject the servers and token configuration from another location during the Axon initialization with spring boot.

Servers values is accessible with a properties at service-catalog.axon-binding.url and token at service-catalog.axon-binding.token. (we have a library that permit to map kubernetes secrets to properties)

Do you know a way to explicitly set the token and servers properties during this initialization ?

Thanks a lot

Mickeybart,
AFAIK there is a Spring Cloud library for Kubernetes that will take all ConfigMaps and Secrets in the current namespace and scan those for additional properties. You can also make use of the fact that Spring-boot scans for “application.properties” and “application.yml” in first the current working directory, and then again in the “config” subdirectory of the current working directory. You can also use the “@PropertySource” annotation to specify additional locations.

As a final option you might want to look at, I know there are ways to further extend the Spring-boot bean manager and hook into its startup, to add a class that loads additional property files. This works by adding a “META-INF/spring.factories” resource that assigns a class name to “org.springframework.boot.env.EnvironmentPostProcessor”. This class must implement EnvironmentPostProcessor and can add property sources, which is a very powerful way to do this.

Cheers,
Bert Laverman

Hi Bert,

Thanks for your feedback.
Your answer confirm what was seen by devs on our side. They already have a EnvironmentPostProcessor in place and they did keys mapping inside this step with success.

That solve the issue.

Thanks again for your time