What are the right reasons for using the java configuration api (rather than spring boot)?

There seems to be a strong preference in the Axon community for using the spring boot configuration of projects. This makes me wonder, what are the right reasons for using the java configuration in a new project instead?

Are these good reasons?

  • When creating microservices that only contain domain objects and only interact with the rest of the domain through Axon messages. I think such a microservice will have little benefit from Spring, besides resource injection?
  • Are there things that are easier to achieve with the fine-grained java configuration? Perhaps something like replaying the event store to only a certain event handler (for example, to add a new report).
  • Anything else?

Thank you

Hello Niel,
If it’s a new project, then the choice between Spring Boot and not Spring Boot could be an organizational decision. Maybe there are several developers and the learning curve (assuming a majority are not familiar with it) is too much of a burden. I think point #1 seems a bit short sighted unless you’re dealing with an app that doesn’t do much and has little to no plans for enhancement. In that case, maybe it’s not even worth the hassle? I don’t know about you, but I find DI to be somewhat of a staple when it comes to app development. Going without just seems a bit masochistic if you ask me…unless you’re into that sort of thing.

Hi Brian,

Thanks for sharing your thoughts. I’m looking at it from a new project perspective and where learning the Spring framework is not an issue.

I’m imagining a design where a bounded context of aggregates et al exists in one or more microservices and the application layer (including things like a web server and services that integrate with third parties) exists in separate microservices that will likely benefit from the Spring ecosystem. All communication will take place using Axon messages. Because the bounded context microservices will almost exclusively consist of Axon components, what benefit will Spring bring? I agree that Dependency Injection is indispensable, but Spring isn’t the only provider.

Thanks
Niel

Hi Niel,

we do see quite some demand for the “plain” configuration API with companies that prefer to set up really lightweight services. If you only have an Aggregate, for example, using the configuration API is a lot simpler and smaller than including the entire Spring Boot ecosystem. However, once you need tracing, additional monitoring, etc, then Spring Boot does provide a nice ecosystem to make that easier to use.

Either way, from an Axon perspective, there is no hard requirement for the use of Spring Boot.

Cheers,