@API(status=STABLE) public final class SpringFactory extends Object implements io.cucumber.core.backend.ObjectFactory
Application beans are accessible from the step definitions using autowiring (with annotations).
SpringFactory uses TestContextManager to manage the spring context. The step definitions are added to the TestContextManagers context and the context is reloaded for each scenario.
The spring context can be configured by:
ContextConfiguration, @ContextHierarchy
or @BootstrapWith. This step definition can also be annotated
with @org.springframework.test.context.web.WebAppConfiguration
or @DirtiesContext annotation.
Notes:
Component or other annotations that mark it as eligible for
detection by classpath scanning. When a step definition class is annotated by @Component or an annotation that has
the @Component stereotype an exception will be thrown
| Constructor and Description |
|---|
SpringFactory() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addClass(Class<?> stepClass) |
<T> T |
getInstance(Class<T> type) |
void |
start() |
void |
stop() |
public boolean addClass(Class<?> stepClass)
addClass in interface io.cucumber.core.backend.ObjectFactorypublic void start()
start in interface io.cucumber.core.backend.ObjectFactorypublic void stop()
stop in interface io.cucumber.core.backend.ObjectFactorypublic <T> T getInstance(Class<T> type)
getInstance in interface io.cucumber.core.backend.ObjectFactoryCopyright © 2020. All rights reserved.