I would like to manually configure my picocontainer to have configured instances of configuration objects for my cucumber build. I.E, providing configuration objects a-la @ConfigurationProperties
in Spring.
However, it is not clear how to do so. The website gives a lot of documentation on how to manipulate a container, but no context surrounding those examples. I am using a Cucumber maven build, using the cucumber-picocontainer
dependency.
Ideally PicoContainer would be able to pick up dependencies from a main yaml/ config file like Spring, but if I can manually enter them into the running container, that works too.
For clarity, I know I can do:
@RunWith(Cucumber.class)
public class RunWithCucumberTest{
public PicoContainer getContainer(){
MutablePicoContainer pico = new DefaultPicoContainer();
//do the config, inject onjects, etc
return pico;
}
}
But this does not mean that the instance returned by this is actually used to inject my properties.
In conclusion, I am looking for a way to use pico container to do one of the following:
- automatically be able to create configuration classes, configured via file (
yaml
,properties
, etc) - Configure the running container manually, creating the objects from configuration myself and giving them to pico to inject later