prashant-ramcharan / courgette-jvm-spring-example

Courgette-JVM with Cucumber Spring Example
3 stars 1 forks source link

How to inject components in batches? #2

Closed jiawade closed 1 month ago

jiawade commented 8 months ago

hello @prashant-ramcharan I'am very new to spring, Suppose there are many components similar to TestSupport that need to be injected in classes. Do we need to manually write them one by one? Is there a way to inject them in batches?

@CucumberContextConfiguration @SpringBootTest(classes = TestSupport.class) public class TestSteps

prashant-ramcharan commented 7 months ago

Hello @jiawade ,

You will just need to create a Spring configuration class with @ComponentScan

This way you can simply annotate your classes with @Component @Service etc. and this will be available in the Spring app context.