GithubHelp home page GithubHelp logo

springtestspockissue's Introduction

springtestspockissue

Reproducing Spring context not injected when using new @SpringbootTest annotation from Spring boot 1.4 in combination with Spock test.

Junit test added and there the injection works fine.

Update:

thanks to the tip from Dan Sayer on the Spring boot I tried with
Spock 1.1-groovy-2.4-rc-1 and now it works. :<)

Update 2: With a little workaround it works for spock 1.0 as well. instead of using @SpringbootTest you have to use the deprecated annotations:

@SpringApplicationConfiguration(TestConfiguration)
@WebIntegrationTest(randomPort = true)

TestConfiguration is a @Configuration bean where a TestRestTemplate
is created code borrowed from [SpringBootTestContextCustomizer](https://github.com/spring-projects/spring-boot/blob/bf8a8167aaafbdb568f178b7d9afe9b3bf94ea3a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizer.java)

A working sample for spock1.0 can be found in branch... spock1.0 ;<)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.