spring-projects / spring-projects/spring-boot

Provide MockWebServer Integration

Open
#14,223 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

I'd like Spring Boot to provide integration with MockWebServer. For my particular case, I'd like to be able to leverage MockWebServer.url to configure environment variables for testing. For example, a user of Spring Boot's Security OAuth2 support might want to provide a value for spring.security.oauth2.resourceserver.jwt.issuer-uri that points to the MockWebServer.

One way a user might be able to integrate this is by providing a property that looks like:

spring.security.oauth2.resourceserver.jwt.issuer-uri=${mockwebserver.url}/oauth2/keys

Spring Boot could provide a hook that would change ${mockwebserver.url} into a URL created using MockWebServer.url.

A few points of consideration:

  • The MockWebServer will need to be accessible to the user to add mock responses
  • We need to be able to reset the MockWebServer between tests.
  • User's may want to customize the MockWebServer

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the requested MockWebServer integration and the example spring.security.oauth2.resourceserver.jwt.issuer-uri property. Determine how users would access, reset, and customize MockWebServer instances and how the ${mockwebserver.url} placeholder should be resolved. Done means these integration points are defined and the OAuth2 testing example works.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.