Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Externally managed mode for ReactorResourceFactory [SPR-17243] #21776

Closed
spring-projects-issues opened this issue Sep 4, 2018 · 3 comments
Closed
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 4, 2018

Rossen Stoyanchev opened SPR-17243 and commented

ReactorResourceFactory has setters for ConnectionProvider and LoopResources that need to be used to make customizations but that doesn't make it clear if those instances should be managed or not. We should probably also add Supplier-based variants for customizations and leave the setters for providing externally managed instances.


Affects: 5.1 RC2

Issue Links:

Referenced from: commits d537a1c, 2163fa9

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

/cc Brian Clozel, have a look at the changes, including the property name change (from globalResources to useGlobalResources).

@spring-projects-issues
Copy link
Collaborator Author

Brian Clozel commented

This change broke the Spring Boot build, even though we're using a very simple arrangement.

The following code snippet breaks:

ReactorResourceFactory resources = new ReactorResourceFactory();
resources.afterPropertiesSet();
ReactorClientHttpConnector connector = new ReactorClientHttpConnector(resources, Function.identity());
 

With the exception

java.lang.IllegalArgumentException: ConnectionProvider not initialized yet via InitializingBean.
	at org.springframework.util.Assert.notNull(Assert.java:198)
	at org.springframework.http.client.reactive.ReactorResourceFactory.getConnectionProvider(ReactorResourceFactory.java:147)
	at org.springframework.http.client.reactive.ReactorClientHttpConnector.initHttpClient(ReactorClientHttpConnector.java:81)
	at org.springframework.http.client.reactive.ReactorClientHttpConnector.<init>(ReactorClientHttpConnector.java:77)
	at Scratch.main(scratch_1.java:17)

It seems that the globalResourcesConsumer is null by default, which means it never initializes the local references to connectionProvider nor loopResources, and makes addGlobalResourcesConsumer  a no-op. 

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

This should be fixed now, and there I've added tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants