GithubHelp home page GithubHelp logo

Comments (4)

wilkinsona avatar wilkinsona commented on June 1, 2024

to register beans on the context and take advantage of test classes @Autowired support for example

If Spring Fu built on top of Boot, which I think it should, you'd benefit from the change that's currently proposed in spring-projects/spring-boot#8115 (comment). Note the custom BeanDefinitionLoader in the repository that @dsyer links to in his comment.

from spring-fu.

sbrannen avatar sbrannen commented on June 1, 2024

Since Spring Fu is heavily based on ApplicationContextInitializer, is there something already supported in SpringExtension we could leverage to register beans on the context and take advantage of test classes @Autowired support for example?

Sure, there are two major options here.

You can register an ApplicationContextInitializer via @ContextConfiguration(initializers = ...).

You can make use of an auto-detected ContextCustomizer. That's actually what Spring Boot Test does, and it was the original PR from @philwebb that got that into the Spring TestContext Framework.

Using an ApplicationContextInitializer would typically require that the end user register it explicitly for each test class; whereas, a ContextCustomizer can be registered automatically by the Spring Fu framework.

These features are of course not specific to JUnit Jupiter. Only the support for constructor and method injection of such beans would be specific to the SpringExtension.

Does one of those options work for you?

from spring-fu.

sdeleuze avatar sdeleuze commented on June 1, 2024

Thanks for your feedback @wilkinsona and @sbrannen, we are going to try to leverage Boot for that indeed.

from spring-fu.

sdeleuze avatar sdeleuze commented on June 1, 2024

Typical Spring Fu tests are just plain JUnit 5 tests + Spring Fu is now based on Boot so I close this issue.

from spring-fu.

Related Issues (20)

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.