Skip to content

Conversation

@artembilan
Copy link
Member

Related to: #10083

The change affects some core classes, since getBeanName() cannot be null after a proper bean initialization

  • Add slight code flow improvement in the BaseHttpInboundEndpoint implementations regarding validate() method
  • Fix DefaultHttpHeaderMapper tests where a ConversionService is required

Related to: spring-projects#10083

The change affects some core classes, since `getBeanName()` cannot be null after a proper bean initialization

* Add slight code flow improvement in the `BaseHttpInboundEndpoint` implementations regarding `validate()` method
* Fix `DefaultHttpHeaderMapper` tests where a `ConversionService` is required
Copy link
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just had a simple question.

controlBusCommandRegistry.setEagerInitialization(true);

return new ControlBusController(controlBusCommandRegistry, conversionService.getIfUnique());
return new ControlBusController(controlBusCommandRegistry, conversionService.getObject());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious. Swapping getIfUnique for getObject is because if there is no object it will throw an Exception instead returning null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point.
I understand that it is a behavior change, but it should be a good one.
The ControlBusController cannot live without conversionService, so getIfUnique() is not OK for us since it may end up with a null.
Therefore I decide to go a hard failure with just getObject() to let the target application know that there is something off with a configuration.
In 99% it should not be a problem since most projects rely on the MVC auto-configuration and that's it.
They don't introduce a custom FormattingConversionService.
When they do, and this fails, they should mark one of the as @Primary to avoid injection collision.

With that I think just FormattingConversionService conversionService as injection point in this ControlBusControllerConfiguration should be enough.
The ObjectProvider.getObject() is total equivalent to regular by type injection.

Let me know if you have any other concerns before I go with clean up!

@cppwfs cppwfs merged commit f1c4e61 into spring-projects:main Aug 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants