-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Re-package WebClient so it isn't in the same jar as the server-side pieces [SPR-16760] #21301
Comments
Rossen Stoyanchev commented
The argument can be taken further to say that the Can you elaborate more on your specific case? I did comment on the HOP ticket. I think it's more an indication that the presence of a module alone is not enough to interpret the intent. Netty and Reactor Netty, for what it's worth, also do not split out client support.
|
Dave Syer commented I'm not sure that netty and reactor are in the same category - I don't use those APIs, and I expect nice wrappers to be provided by Spring and Spring Boot. The issue really comes down to the behaviour of Spring Boot when
I get that breaking this up means 1 jar might become 2 or 3. I can see why you'd rather not do it. But I think Spring Framework owes this as a courtesy to Spring Boot and Spring Boot users, where there really isn't an acceptable way to implement sensible autoconfig for a webflux server without the split. |
Brian Clozel commented HOP is a bad example here, because moving to reactor-netty is a better choice for them as a lightweight library that doesn't need a full blown web framework just to send HTTP requests and decode JSON. The cf-java-client team made the same choice and I believe it's the right one. We did talk numerous times about that possible split before 5.0, and if I remember correctly the rationale for keeping everything together was:
I think that splitting the current arrangement in several jars would require moving public classes to different packages, breaking backwards compatibility. The alternative, using split packages, is definitely not a good idea. Now I don't consider the Spring Boot configuration flag as a workaround, as it's been there (under a different name) for ages, switching on/off the web server auto-configuration. If the If anything, we could make that a bit more obvious in the Spring Framework reference documentation (what |
Dave Syer commented
That's the assumption that I think is invalid. Which reactive HTTP client would we recommend for use not in a server application, if not this one? What part of it makes it more useful in a server than out? It doesn't make any sense still to me, but I'm happy to learn that I am wrong. If I am wrong then I think we need another HTTP client. |
Arnaud Cogoluègnes commented What would be the recommendation for a batch application using Spring Boot batch starter and in need of a reactive HTTP client? I admit it's a bit far-fetched, but using |
Rossen Stoyanchev commented In addition to the It's not just about the extra jars though. It's about how package structure and module boundary decisions are made. I have a hard time accepting that autoconfig should dictate such decisions even in cases where we do have control. The current structure under o.s.w.r.function makes sense, it's what we arrived at, and is the preferred structure. As for the docs, what would we actually say? I find "WebClient is not meant to be distributed as an independent client library" rather vague. Using only On the HOP ticket I asked about the possibility to detect if
Thanks and good to know. Let me expand on the idea rather than prescribing the solution. Currently a WebFlux server is started when What if the model was reversed? Make no assumptions from the presence of Some such change, e.g. a property, manifest attribute, or any marker in the webflux starter, that can then be detected should not disrupt existing applications since they already declare the webflux starter. I understand such a change goes against current practice, but may be there is some generally useful feature that can come out of this? As for applications that intentionally don't declare the webflux starter but want a WebFlux server, they would have to use something like the The alternative of breaking up spring-webflux, this far into 5.0.x, when it's already used in applications and frameworks, is going to cause enough pain and is practically a non-starter. The docs could be updated to explain about the use of |
Rossen Stoyanchev commented Arnaud Cogoluègnes, the spring-batch example might not be very common indeed, I can't say, but the Spring Integration HTTP outbound adapter is currently using the |
Phil Webb commented If you consider the design of |
Stéphane Nicoll commented
That would be a breaking change (and not a small one). There are several ways to see the current big picture but I think we haven't discussed much about what Spring Boot is doing. Being opinionated at the right level proved to be very popular IMO. Adding In Spring Boot 2, our goal was to offer the same developer experience and a consistent set of use cases regardless of the kind of app you want to build. So, naturally, there is a webflux starter that is the mirror of the web starter, and it also starts a web server by default.
IMO, that is not what's happening here. If you look at the features parity I mentioned earlier, the http client is a separate unit in the MVC world and isnt' in the reactive world. The auto-config doesn't dictate anything, it tries to adapt to this new world with similar concepts.
|
Rossen Stoyanchev commented I'm not questioning the decisions made and I agree completely that Boot 2 autoconfig does not dictate anything but rather adapts and evolves the model with Spring MVC. I am pointing out the need to evolve autoconfig rather than expect spring-webflux to be broken up. I am not suggesting a breaking change. You only quote the first sentence of that paragraph. I can't say what the solution is but I guess the conversation on that continues under the Boot ticket Phil created, and I'm learning myself from the discussions on that so far. To elaborate on Phil's comment about spring-webflux being closer to spring-web than spring-webmvc, the root package of spring-webmvc,
|
Rossen Stoyanchev commented Resolving for now reflecting the discussion. Depending on the outcome of #12973, if there is no change, then we could consider some doc update. For example if there was one place that explains thoroughly how Spring Boot autoconfig works with regards to spring-webflux, then we could link to that from the Spring Framework reference, and that I think would be all the information we need to provide. From what I could find Web Environment talks about Spring MVC + spring-webflux, there is also the WebClient section but nothing to put the full picture together -- i.e. that spring-webflux implies a web environment and that will start a WebFlux server, unless Spring MVC is there too, so if you're using the WebClient in any other scenario (neither Spring MVC, not WebFlux server), then you have to turn off the web environment property too. |
Dave Syer opened SPR-16760 and commented
If WebClient is a general purpose HTTP client (which I take to be the case, and seems to fit with the messaging from the Framework team) then I feel quite strongly that it should be packaged separately from the server-side components. If all I want is a client, I shouldn't have the server stuff on the classpath. I don't think I'm the only one to be bitten by this (e.g. https://github.com/rabbitmq/hop/issues/122 It also leads to Spring Boot making a false assumption about my intention to start a server.
Affects: 5.0.5
0 votes, 9 watchers
The text was updated successfully, but these errors were encountered: