PicoContainer Is Almost Invisible

PicoContainer is probably the simplest DI container on the JVM, which is why we’ve been using it. It’s certainly the simplest to integrate with Cucumber. Some of the other containers have more options, but PicoContainer is sufficient for most applications. The most likely reason to not use PicoContainer is that your application is already using another DI container.

Our use of PicoContainer is so unobtrusive that you may well have forgotten all about it by now. The only evidence that we’re even using it at all are two dependencies in our pom.xml:

dependency_injection/pico/01/pom.xml
 
<dependency>
 
<groupId>​info.cukes​</groupId>
 
<artifactId>​cucumber-picocontainer​</artifactId>
 
<version>​${cucumber.version}​ ...

Get The Cucumber for Java Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.