How to inject spring beans into spock test

前端 未结 1 905
攒了一身酷
攒了一身酷 2020-12-31 20:34

I am new to spock. I am trying to write a spock unit test against a standalone java app that uses JDK 1.7, Spring 3.1, Groovy 1.8.6, Spock 0.6, Maven 3.0.4. A basic hello wo

1条回答
  •  灰色年华
    2020-12-31 21:09

    you most likely forgot to include a Spock Spring dependency.

    Here is how to get it using:

    maven

    
       org.spockframework
       spock-spring
       0.6-groovy-1.8
    
    

    gradle

    'org.spockframework:spock-spring:0.6-groovy-1.8'
    

    plain groovy

    @Grapes(
        @Grab(group='org.spockframework', module='spock-spring', version='0.6-groovy-1.8')
    )
    

    *0.6-groovy-1.8 is the current version, if you need another one, just substitute

    0 讨论(0)
提交回复
热议问题