vendredi 11 novembre 2016

How to override application Bean in SpringBootTest

I'm writing an integration test for my Spring Boot web service and need to displace the injection of a Bean (it is actually a Kafka Consumer object in this case) with a test implementation.

It used to be simple to provide an xml file to define an alternate bean implementation or configuration, but we are now using Spring Boot and Java based configuration with annotations.

I've battled through the badly written Spring-Boot documentation and cannot get anything to work. The Spring documentation was written with the premise that the reader already knows everything there is to know about Spring Boot and so is practically useless.

I'm sorry I don't have code to share because I've tried every potential solution and none of them work. I'm looking for a best practice solution example...

Aucun commentaire:

Enregistrer un commentaire