spring-projects / spring-projects/spring-boot

Revisit Reactive context hierarchy

Open
#16,411 0 comments 0 reactions 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

The context hierarchy for reactive support contains a number of classes that do not seem very useful:

  • ConfigurableReactiveWebApplicationContext seems to be a marker interface
  • StandardReactiveWebEnvironment is just a StandardEnvironment that implements the empty ConfigurableReactiveWebEnvironment marker interface

There are two distincts reasons for this hierarchy

ConfigurableReactiveWebApplicationContext seems to be only used by ReactiveWebApplicationContextRunner. The bottom line is that the supplier must provide a ConfigurableReactiveWebApplicationContext but what the infrastructure really requires behind the scene is a ConfigurableApplicationContext that can be identified by the conditions as being reactive. Such type does not give you that guarantee as you may have a context that implements ConfigurableReactiveWebApplicationContext but returns an Environment that is not a ConfigurableReactiveWebEnvironment. Perhaps we could remove this in benefit of a check of the environment as that's what our condition is mostly using.

As for the environment itself, a SpringBootEnvironment that is a StandardEnvironment and has a WebApplicationType accessor would be enough for most use cases except the servlet one. Rather than creating a complete hierarchy for that, maybe we should simply create such dedicated environment and check for its presence in the conditions?

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 tracing ConfigurableReactiveWebApplicationContext, StandardReactiveWebEnvironment, ConfigurableReactiveWebEnvironment, and ReactiveWebApplicationContextRunner, then inspect how the conditions identify reactive contexts. Done means reaching agreement on a simpler hierarchy or environment design and updating the affected infrastructure and condition checks consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend
Issue type
Refactor
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.