Take a look at this tutorial that explains dependency injectors and how their ability to insert business logic at runtime can help you with Cucumber code.