lundi 30 mars 2020

Adding a specific components to the Spring Context when creating a facade component

Rather than making some of my classes @Autowire many small @Components, I wanted to create a single @Component that would collect and just forward to the smaller @Components.

Coding itself isn't too difficult, but when it comes to testing, it becomes cumbersome because now I have to add it to the @ContextConfiguration(classes). Is there a way of doing it so I don't have to manage it individually?

Using @ComponentScan adds the whole package which I may not want because it will trigger more @MockBean to be created.

Aucun commentaire:

Enregistrer un commentaire