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-issuemaster opened this issue Sep 4, 2018 · 3 comments
Closed

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

spring-issuemaster opened this issue Sep 4, 2018 · 3 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster 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:

  • #21733 ReactorHttpResources should clear HttpResources in global mode

Referenced from: commits d537a1c, 2163fa9

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 6, 2018

Rossen Stoyanchev commented

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

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 6, 2018

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 6, 2018

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
Projects
None yet
2 participants
You can’t perform that action at this time.