Giter VIP home page Giter VIP logo

Comments (5)

ch4mpy avatar ch4mpy commented on June 12, 2024

@andreasgerner can you share your project or a reproducer? What you are doing seems pretty close to what is done at several places in this repo (and others that I author), so it should work (this can be due to your security config or whatever)...

from spring-addons.

andreasgerner avatar andreasgerner commented on June 12, 2024

I setup a sample containing everything that should be needed to reproduce.

from spring-addons.

ch4mpy avatar ch4mpy commented on June 12, 2024

@andreasgerner I found a few things to fix in your reproducer:

  • the values in your src/main/resources/application.yaml should be resolved (use environment variables to override this values when you start the program, not inside the yaml)
oidc:
  issuer-url: https://some-issuer.com/auth/realms/master
  client-id: client-id
  • the test resources override main application.properties and the com.c4-soft.* are lost => rename src/test/resources/application.yaml to src/test/resources/application-test.yaml
  • the test itself is not a Spring test (you probably want to run a @WithMckMvc or @SpringBootTest, so decorate the test with what is relevant)

from spring-addons.

andreasgerner avatar andreasgerner commented on June 12, 2024

Migrating from pure unit tests to @SpringBootTest integration tests resolved my issue, thank you!

from spring-addons.

ch4mpy avatar ch4mpy commented on June 12, 2024

@andreasgerner you're welcome. thank you for taking time to provide with reproducer. Please note that @SpringBootTest should be used with care as it can slow down tests execution by loading more of the application context than what is actually needed. Use @WebMvcTest when testing a controller and specify the minimum configuration classes to load when using @SpringBootTest.

from spring-addons.

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.