-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring example hook path #649
Conversation
…g bean. Got a NoSuchBeanDefinitionException instead. ```` org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.transaction.PlatformTransactionManager] is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:295) at cucumber.api.spring.SpringTransactionHooks.obtainPlatformTransactionManager(SpringTransactionHooks.java:65) at cucumber.api.spring.SpringTransactionHooks.rollBackTransaction(SpringTransactionHooks.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... ```` Relies on the #644, #637 issues.
Please do not merge and keep discussion in the #637 issue's thread. |
Strange - this passes on Orcale JDK and fails on OpenJDK: https://travis-ci.org/cucumber/cucumber-jvm/builds/15550646 |
@aslakhellesoy No, it does not pass on Oracle JDK. On Travis the jobs on Oracle JDK does not run the examples, they instead deploy the snapshots (the Android module, or the rest of the modules, depending on the job). |
So, I did a couple of tests and It seems that when the cucumer-glue.xml is loaded there is no PlatformTransactionManager.class instance in the application context, as it is user defined, and thats why it crashes. If you remove the SpringTransactionHooks bean from the cucumer-glue.xml and add it on the user applicationContext.xml it works. I don't really think of an workaround, any ideas? |
To my best knowledge the situation is like this:
BTW the see_message.feature of the spring-txn example does not, and have never, worked together with transactions, it was added during the time the spring-txn example did not include the SpringTransactionHooks class in its glue path (see this Travis build for a error log) |
Would not it be nicer if hooks ( SpringTransactionHooks in this case) could share the context with the step definitions? I will give a try to look into this as much as my knowledge of cucumber-jvm and spring internals would allow. |
@mgurov I agree. Now there seems to be two very separate context. SpringTransactionHooks (and the other classes in the cucumber spring module) knows only about what is defined in The step definition classes on the other hand (which have the |
A "hack" to make the spring transaction support work is to let the cucumber.runtime.java.spring.SpringFactory "detect" the @ContextConfiguration annotation on the step definition classes and apply that configuration also to the SpringTransactionHooks, see #644. |
If you can, please join here Mon, May 12, 3:00 PM - 4:00 PM to discuss: https://plus.google.com/u/0/events/cstdgkbvp61g7gld8lejsap4j3o |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixed the NPE in in SpringTransactionHooks by turnign it into a Spring bean.
Got a NoSuchBeanDefinitionException instead.
Relies on the #644, #637 issues.