-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TestContainer: properties precedence over ServerConnection #3022
Comments
Thanks for reporting this. I would expect the configuration: @ConditionalOnBean(type = "org.axonframework.springboot.service.connection.AxonServerConnectionDetails")
@Bean
public AxonServerConfiguration axonServerConfigurationWithConnectionDetails(AxonServerConnectionDetails connectionDetails) {
AxonServerConfiguration configuration = new AxonServerConfiguration();
configuration.setComponentName(clientName(applicationContext.getId()));
configuration.setServers(connectionDetails.routingServers());
return configuration;
} Would make sure the servers from the |
When debugging, the instance is properly created by this axonServerConfigurationWithConnectionDetails From the javadoc for
So this does not sound like a ordering issue but tied to the fact that this |
Basic information
Steps to reproduce
@TestContainers
AxonServerContainer
as a field of the test class, annotated with@Container
and@ServiceConnection
axon.axonserver.servers
property in a property file withunknownhost
, which is an unresolvable host.Expected behaviour
The
@ServiceConnection
annotation has precedence over property based configuration and the Axon Server test container can be accessed by the test.Actual behaviour
The property
axon.axonserver.servers
set tounknownhost
overrides the configuration generated thanks to the@ServiceConnection
annotation.By looking at JDBC implementation, this precedence is properly handled by having the connection details object (JdbcConnectionDetails) being an interface distinct from the properties object (DataSourceProperties), allowing for a property based implementation of the connection details and a test container based implementation of the same connection details interface.
In Axon Framework, AxonServerConfiguration is both bound to a
ConfigurationProperties
and created by a connection detail factory when using test containers.The text was updated successfully, but these errors were encountered: