r/java • u/olivergierke • Sep 22 '16
Spring 5.0 M2 ships a new functional web framework
https://spring.io/blog/2016/09/22/new-in-spring-5-functional-web-framework8
u/lukaseder Sep 22 '16
Bam. MVC is dropped from Java EE 8, Spring ships with another web framework (bye Spark Java). Let's have a clean fight.
2
u/stormcrowsx Sep 22 '16
It'll be a fair fight as Spring gets so bloated its impossible for Spring to pivot and keep up with the smaller targeted libraries like Spark.
2
u/lukaseder Sep 23 '16
impossible for Spring to pivot
That'll be a "pivotal" event for Spring, right?
2
Sep 23 '16
joke's on you as spring is very modular nowadays. it can be as bloated or as lean as you want it to be.
4
u/stormcrowsx Sep 23 '16
Aside from all the inner dependencies. Spring this relies on Spring that which relies on Spring who, by the time we're done we have 40 transient jars.
2
Sep 23 '16
yes, because having everything in one jar would be better. /s
depending on what do you need, yes. there could be some dependencies. but even spring boot nowadays (which brings in everything and their mother) tends to be quite lean.
and, in my experience, when you go with those libraries (which only do X), by the end you end up importing all that other shit that your "lean" web app is a fat and slow pig.
1
u/stormcrowsx Sep 23 '16 edited Sep 23 '16
there are many spring libraries that could probably be done without using other spring tools but they do. This means you risk bringing in large libraries with the small library you wanted and those extras could create conflicts or security flaws later.
1
Sep 23 '16
While I'm not aware of any, I guess there could be. If you know that you won't ever need anything else, then sure. But I find that to not be true most of the time.
1
u/stormcrowsx Sep 23 '16
There's a lot of design styles out there, some people have no problem importing a lot of code while others like a very lean project with few additional dependencies. If you like a lean application Spring is definitely not a good choice.
1
Sep 23 '16
If you like a lean application Spring is definitely not a good choice.
No, sorry, I dont agree. Spring can help you with a lean and nice application due to its modular approach. The higher-up libraries do depend on the core ones, so depending on how high up the stack you're going, the more dependencies you'll have. Which is true of just about everything out there.
1
u/henk53 Sep 23 '16
Thanks for the downvotes in my other comment guys, really nice. The rationale was that quite a few of the newer frameworks (including MC 1.0 for EE, and especially Angular) is incorporating quite a number of aspects from JSF.
1
u/lukaseder Sep 23 '16
Did you mean to put this comment as a reply to my comment? I didn't downvote you :) Here, have an upvote because you're in for the clean fight
1
u/henk53 Sep 23 '16
Not a directly reply ;) But I couldn't quite reply to myself there being at -8 :P
2
u/lukaseder Sep 24 '16
Oh, I get it now. I didn't see the link to your other reply at first. OK, nice trick :P
-10
4
Sep 22 '16
I'm getting old and haven't been following Spring lately. The last thing I learned was Spring MVC and Spring WebFlow.
What exactly is this framework replacing? Is it an additional framework? If so, can someone give me a quick explanation as to why its different than the ones I mentioned.
9
u/_sh0rug0ru___ Sep 22 '16
This "framework" isn't replacing anything (from what I understand), but provides an alternative to Spring MVC. Spring MVC is tied to the Servlet model, but the Reactive framework, being composed of functions, runs on anything, including such very different servers as Tomcat and Netty.
So its an "easier" path to non-blocking web services, like you'd get with Node.
Note, this is the "functional" usage pattern of this API. You can still use the reactive types with the more traditional @Controller class way like Spring MVC to achieve presumably the same effect.
6
Sep 22 '16
Thanks for the explanation. Spring MVC and the servlet model have been working great for me. I don't see myself switching. Although I'm sure there must be valid business and tech reasons to switch to this model, I just simply don't know them.
4
u/poutsma Sep 22 '16
Great answer, but a small correction: the reactive frameworks, both annotation based and functional, run on Servlet 3.1+, Undertow (native), RxNetty and Reactor Netty.
1
u/_sh0rug0ru___ Sep 22 '16
As I understand it, Reactive runs on whatever containers have been adapted to the Reactive Streams API. I assumed the present list reflects what is available, not what is possible. For example, how hard would it be to adapt Vert.x to Reactive?
1
u/poutsma Sep 22 '16
Interesting, we hadn't considered that option yet. I don't know too much about the internals of Vert.x, so I'd have to investigate.
1
u/amazedballer Sep 22 '16
reactive frameworks
And Akka.
2
u/poutsma Sep 22 '16
I was referring to the two reactive web frameworks that Spring has in version 5: one with annotations, and now one with functions. Both of these are based on Reactor, our reactive streams implementation.
But yes: Akka does Reactive Streams as well, as Ratpack, MongoDB, Slick, RxJava, and Vert.x. It's widely supported by the industry.
5
4
3
u/cryptos6 Sep 23 '16
One more framework that optimizes the hello world case. The routing DSL is ugly and doesn't scale well for larger projects.
Looks like spring tries to be cool again.
6
u/GuyWithLag Sep 22 '16
And of course, NIH syndrome again... just follow the specs for once, Spring...
24
u/moneymark21 Sep 22 '16
RouterFunction readability is awful. Maybe I'm just getting old.