cucumber/cucumber-jvm — pull request #203 by vladimirkl (2012-02-13 10:13:34+00:00)
Title: Allowed customization of Spring step definitions context

Hi,
I've created this pull request because current implementation of SpringFactory makes impossible to customize step definitions context. Actually we have singleton parent context configured in _cucumber.xml_ and child StaticApplicationContext that is created on the fly for every scenario. SpringFactory registers only AutowiredAnnotationBeanPostProcessor in child context and that's all. There is no way to register any additional bean post processor or bean factory post processor. We cannot have PropertyPlaceholderConfigurer in child context, @PersistenceContext annotation support and many other useful things.

So I made the following:

+ Replaced child StaticApplicationContext with child ClassPathXmlApplicationContext
+ Made child ClassPathXmlApplicationContext to take "classpath*:cucumber-steps.xml" location as constructor parameter. So it finds all _cucumber-steps.xml_ files on the classpath.
+ Added basic cucumber-steps.xml file to cucumber-spring. This file has only context:annotation-config declaration - to made autowiring annotations working from scratch.

So any additional cucumber-steps.xml files may add customization to step definitions context. I've added one with PropertyPlaceholderConfigurer to test suite and added a test checking that it is working.