Closed schulzh closed 3 years ago
VaultReactiveAutoConfiguration
doesn't expose ClientHttpConnector
, instead it gets created in the createConnector(…)
method which allows creation in the afterPropertiesSet()
method. Until now, no one asked for further customizations so we didn't implement a wrapper around ClientHttpConnector
. A connector is a pretty generic bean therefore exposing it as top-level type isn't a good idea since it might interfere with other components that want to use a reactive HTTP client.
That being said, feel free to submit a pull request to align VaultReactiveAutoConfiguration
with VaultAutoConfiguration
. Make sure to have also a look at VaultConfigDataLoader.ReactiveInfrastructure#registerClientHttpConnector
as parts of the configuration are registered early on to work with Spring Boot's ConfigData API.
Allowing a custom connector requires some additional API and a bit more changes therefore we can do this only in the 3.x line.
I need to supply a custom ClientHttpConnector for connecting to vault because I need to use a custom KeyManager in the reactive client which cannot be configured using config properties.
Since 3.0.0 this is easy for the normal
VaultAutoConfiguration
, I can just create a bootstrap configuration class that supplies a bean of typeAbstractVaultConfiguration.ClientFactoryWrapper
with higher precedence, which will then be used inAbstractVaultConfiguration#vaultTemplate()
to build the VaultTemplate. However, for the ReactiveVaultTemplate this is not straight forward, since theClientHttpConnector
is not exposed as a bean.Am I missing a straight forward way of achieving this? I have a solution kind of working using reflections in a BeanPostProcessor, but that is very error prone. If not, I would also like to implement this. What would be the best way to approach this? Create a wrapper class like
ClientFactoryWrapper
for theClientHttpConnector
that is exposed as a bean?