Package io.cucumber.spring
Class SpringFactory
- java.lang.Object
-
- io.cucumber.spring.SpringFactory
-
- All Implemented Interfaces:
Container,Lookup,ObjectFactory
@API(status=STABLE) public final class SpringFactory extends Object implements ObjectFactory
Spring based implementation of ObjectFactory.Application beans are accessible from the step definitions using autowiring (with annotations).
The spring context can be configured by annotating one glue class with a @
CucumberContextConfigurationand any one of the following @ContextConfiguration, @ContextHierarchyor @BootstrapWith. This glue class can also be annotated with @WebAppConfigurationor @DirtiesContextannotation.Notes:
- SpringFactory uses Springs TestContextManager framework to manage the
spring context. The class annotated with
CucumberContextConfigurationwill be use to instantiate theTestContextManager. - If not exactly one glue class is annotated with
CucumberContextConfigurationan exception will be thrown. - Step definitions should not be annotated with @
Componentor 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 Summary
Constructors Constructor Description SpringFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddClass(Class<?> stepClass)<T> TgetInstance(Class<T> type)voidstart()voidstop()
-
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceObjectFactory
-
stop
public void stop()
- Specified by:
stopin interfaceObjectFactory
-
getInstance
public <T> T getInstance(Class<T> type)
- Specified by:
getInstancein interfaceLookup
-
-