News for hackers. Stuff that matters.
Re:Spring vs. Java EE by openasocket on Sunday April 09, 2017 @01:49PM (#14073446)
I like Java, but I've never tried diving into the Spring or Java EE world. The little I've looked at it seem daunting and complex and I'm not sure what it really gives you at the end of the day. What functionality does it provide, what are the killer features? And is all this complexity justified?
Re:Spring vs. Java EE by orless on Sunday April 09, 2017 @02:35PM (#14073665)
I work with Spring and Java EE professionally, prefer Spring wherever I can. Also use Spring for private/side projects (if not plain Java). But I'll talk about Spring here.

I see two import aspects that Spring provide: first, dependency injection/inversion of control as basis and then a way to 1000+1 things "right".

Dependency injection is important because it provides a healthy way to compose an application from many components or services. It's not exclusive to Spring of course, you can do DI/IoC without Spring (even without any framework), but it's baked into the very nature of Spring.

Next, Spring provides "right" way to do a lot of more-or-less standard things. You have solutions for ORM, REST interfaces, security, batch processing and a thousand more tasks. From my experience, Spring solutions are mostly good or very good, at least much better than I'd design in a limited time frame. This gets me faster to the working solution.

I also don't thing that Spring brings that much of a complexity overhead. Once you got past the first threshold (like, you can assemble you application from a few components) you're good to go. Ok, you will eventually need to learn concepts of individual Spring components (like ORM or security), but you'd need to learn them anyway.

Eventually you'll need to fight Spring here and there, I won't deny it. This is normally related to the "automagical" stuff like autowiring or autoconfigurations - things which make your work easier in 98% but might make you crazy for the rest 2%.

Re:Spring vs. Java EE by springsux on Monday April 10, 2017 @12:07AM (#14075935)
> I see two import aspects that Spring provide: first, dependency injection/inversion of control as basis and then a way to 1000+1 things "right".

DI creates debugging nightmares by moving what used to be compile time checks to runtime. Fowler was wrong.

Re:Spring vs. Java EE by mvindahl on Monday April 10, 2017 @01:37AM (#14076328)
This is a discussion that I've occasionally tried to raise with colleagues. I usually find myself in a pretty isolated position, but anyway..

My viewpoint is, roughly:

1) DI, as described in the GoF book is a great pattern. You compose objects by passing other objects to its constructor as needed. These are the stored in final fields for the lifetime of the parent object. The pattern gives a lot of flexibility and handles a lot of use cases which it may otherwise be tempting to handle using the inferior concept of inheritance. It's simple, it's typesafe, it's easy to debug.

2) DI, as implemented by virtually any DI framework, is the Devil. Most DI frameworks is little more than a big dictionary mapping interface types (or magic strings) to implementation classes, along with some black-box magic to make it work (and bloat your stacktraces). It saves you the effort of calling constructors explicitly but any gains are lost as soon as you need to debug stuff. It shares a lot of traits with that other big dictionary where you can dump stuff for convenience: the global scope. It also has the same backdraws.

But anyway, this is a minority position so there is a large chance that I'm dead wrong and a small chance that history will prove me right.

Re:Spring vs. Java EE by orless on Monday April 10, 2017 @08:13AM (#14077813)
Somehow I don't share your experience. What are the problem with DI and debugging? I had a lot WTF moments with automagical things, but not with pure DI.
Re:Spring vs. Java EE by baylisscg on Sunday April 09, 2017 @08:32PM (#14075126)
I'd add a few more caveats.

- Not all Spring projects seem to receive equal love. They can and do stomp on each other. - Spring's get-going-quickly seems to mostly come from serious design assumptions. Which is fine per se but they are not made clear which is not OK. - Spring is far too automagical. My latest bugbear is it deciding to change defaults depending on what it thinks I want. Bonus points for there being multiple settings that control the same behaviour only one of which can override.

You're not using Java anymore you're using Spring.

Re:Spring vs. Java EE by cle on Sunday April 09, 2017 @02:03PM (#14073510)
The Spring that I've used (the DI Framework, Spring Integration, Spring MVC) is mainly designed to simplify and standardize enterprise applications. Mostly this involves standard and automated ways to "wire" together applications. This includes DI, but also includes configuration (e.g. configuration to enable a deployment pipeline), communication between components/services (client and server mapping of messages in a message bus to their ser/de impl and schema definitions, database interfaces), service and UI implementations themselves (SpringMVC, Spring Boot), etc. The benefit is that Spring is a glue layer that integrates all these various pieces of "enterprise" systems with minimal boilerplate.

I don't have much experience with Java EE, so can't comment. My experience with Spring is not very positive--it enables and encourages applications and systems to have complex dependency graphs, and so often I've seen this result in giant balls of mud that, despite Spring's claim that it enables decoupled and modularized design, are rat's nests of unexpected coupling and hard-to-predict behavior.

Re:Spring vs. Java EE by ivan_gammel on Sunday April 09, 2017 @02:16PM (#14073578)
Spring (and latest JEE editions with better support of DI) no more encourages spaghetti designs than does manual wiring of objects, so usually these giant balls of mud are the result of project management and design mistakes, not the failure of the tool. In fact, properly designed system that uses DI is indeed decoupled (because you can limit the number of interfaces between components) and modularized (because you can wire dependency of one module on interface with implementation in another one). Moreover, it opens the way to plugin architecture, because application context definition can serve also as plugin definition and there exists discovery mechanism (e.g. classpath:/plugins/*.xml in plain DI or Spring Boot AutoConfiguration).
Re:Spring vs. Java EE by cle on Sunday April 09, 2017 @03:55PM (#14074060)
It enables such designs, by making it easy for someone to add more crap into your ball of mud. Not everyone on your team is as smart or experienced as you. When their back is against the wall with a deadline...just throw some more beans in there, who cares how they're wired together, it's all handled by Spring!

Well, you care when you have an unexpected complex circular dependency or you need to refactor and you suddenly discover how complex your dependency graph has unintentionally become.

By "decoupling" and "modularization", I'm not talking about at a code-level by using interfaces. In my opinion, that kind of decoupling and modularization isn't very important, especially when it comes to application glue--because the glue (Spring) is what decides the backing impl's of all those interfaces. That's where the important dependencies lie, and that's where your big ball of mud accretes.

Re:Spring vs. Java EE by kazagistar on Monday April 10, 2017 @01:52AM (#14076371)
> When their back is against the wall with a deadline...just throw some more beans in there, who cares how they're wired together, it's all handled by Spring!

I just came across a controller in our code that had over 50 spring injected services. Our entire code base is only like 5 years old.

The problem is that this is my first job out of college... even if I know things are messed up, I don't really have an example of an application like this that is actually done right.

Re:Spring vs. Java EE by qw on Monday April 10, 2017 @04:05AM (#14076802)
I prefer controllers to have only one service. A controller should do as little as possible. Its responsibility is just to pass data from the request to the service.

The same should apply to repositories unless it is absolutely necessary. It should ideally just know enough to manage itself

A service may reference other services if it needs to coordinate actions. We need to be careful not to make huge services that contains too much logic though

I have found that this pattern makes it not only easier to structure the application, but also much easier to make mocked tests.

Re:Spring vs. Java EE by ivan_gammel on Monday April 10, 2017 @01:47AM (#14076348)
It is not a tool problem. Programming tools always address two problems: coding performance and coding quality. But the design, the architecture is not something that could be fixed by a tool. Frameworks may add or remove some constraints, but there's always enough space for the side effects of human creativity. People always break or misuse the tools, creating the balls of mud. It's not a problem with these tools, it's a problem with organization of development process, with competencies of decision makers, with inadequate constraints and unclear requirements. It's easy to blame the tool, throw away the ball of mud and start from scratch with fancy new tech. But in the end you'll get the same ball of mud, because you have ignored the root causes.
Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @02:31PM (#14073643)
I think maybe this comes down to the kind of injection. If you rely on variable or setter injection, you can easily create a kind of dark matter that invisibly warps the flexibility of the project.

I and others have generally found that using Constructor injection greatly decouples a design and simplifies testing.

And the Spring team have been saying so for at least as long as I've paid attention to the question[0]:

> Constructor-based or setter-based DI?

> ...

> The Spring team generally advocates constructor injection as it enables one to implement application components as immutable objects and to ensure that required dependencies are not null. Furthermore constructor-injected components are always returned to client (calling) code in a fully initialized state.

> ...

[0] https://docs.spring.io/spring/docs/current/spring-framework-...

Re:Spring vs. Java EE by tigershark on Sunday April 09, 2017 @08:37PM (#14075142)
They are two different tools needed for two different jobs. Constructor injection is for mandatory dependencies, setter injection is for optional dependencies. If you are writing a plugin application and some modules are optional then you cannot use constructor injection because when the optional module is not present you cannot start your whole application. In 99% of the cases obviously constructor injection is the way to go.
Re:Spring vs. Java EE by twic on Sunday April 09, 2017 @06:11PM (#14074608)
If you want to see big balls of mud created using setter injection, you're welcome to visit any of the projects i worked on when i was at Pivotal!
Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @08:47PM (#14075190)
I am guilty of this too. It's why I'm a bit of a constructorist these days.
Re:Spring vs. Java EE by twic on Monday April 10, 2017 @04:54PM (#14082455)
Aargh. I meant using constructor injection. It didn't save us.
Re:Spring vs. Java EE by ivan_gammel on Sunday April 09, 2017 @03:37PM (#14073983)
Nope. There is no difference between injection types from the coupling perspective, simply because neither blocks anything bad from happening in your architecture. There are reasons to prefer constructor injection in many cases, but it has nothing to do with modularity or coupling.
Re:Spring vs. Java EE by spiralpolitik on Sunday April 09, 2017 @05:11PM (#14074390)
With Constructor based injection its easier to see layering and coupling issues as once your constructor gets more that 3-4 parameters then it starts becoming blindingly obvious that the class has too many dependencies and needs to be refactored. This helps keep the bad out of the architecture.

The main reason to favor constructor based injection is that it stops objects becoming 'live' in an inconsistent state. I've seen actual production issues with setter based injection that can only be explained by the object being available for use before all the setters have been called.

Re:Spring vs. Java EE by ivan_gammel on Monday April 10, 2017 @01:52AM (#14076373)
Your arguments are valid on why constructor injection should be preferred. However, what are you talking about is the human-made decision: "Stop adding more parameters to constructor". The tool does not force you to build high-quality architecture, it is your choice based on your experience and skills. Other people who are not yet aware about the consequences may still make wrong design decisions and they'll be ok with lots of parameters.
Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @04:39PM (#14074250)
I disagree.

Constructor injection in Spring is more test-friendly; in turn that tends to allow us the liberty of more aggressively modularising the design. With other injection types either more bookkeeping is required to cleanly set up tests; or alternatively, "unit" testing becomes more integration-esque.

It's a second-order effect felt in the many small decisions that lead one to the mudpit.

That's why I used the analogy of dark matter. It's not directly observed, but it has gravity.

Re:Spring vs. Java EE by EdwardDiego on Sunday April 09, 2017 @08:06PM (#14075039)
> Constructor injection in Spring is more test-friendly

These are my thoughts too. No reflection or @MoreAnnotations to inject dependencies. I have an aversion to setter/field based injection because it allows you to instantiate an object in an incorrect state.

Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @08:50PM (#14075206)
> I have an aversion to setter/field based injection because it allows you to instantiate an object in an incorrect state.

Oh yes. I recognise that JavaBeans had its reasons for being, but then you get to JPA and it's time for all the boggling.

Re:Spring vs. Java EE by lazulicurio on Monday April 10, 2017 @06:50AM (#14077386)
My personal pet peeve is bean validation. The goals of the API are laudable, but the fact that the implementation is annotation-driven drives me nuts.

Annotations are fine for intra-project code contracts, but using them for external validation means that if you, say, deploy on a application server with an older version of Jersey, you're suddenly SOL when none of your validation logic is executed.

Re:Spring vs. Java EE by twic on Sunday April 09, 2017 @06:15PM (#14074629)
> Constructor injection in Spring is more test-friendly

If you get in the habit of using the Spring test support, where classes under test get injected, then all kinds of injection are equally friendly, and the tests don't give you feedback on the weight of the dependencies because Spring does the heavy lifting.

And, in my experience, where you do inject dependencies by hand, the design pressure is actually towards coarser-grained objects. Why? Because you need to have enough functionality to test; with fine-grained objects, you have to construct and assemble an object graph in the test, whereas with coarse-grained objects, you just new up one thing.

Re:Spring vs. Java EE by EdwardDiego on Sunday April 09, 2017 @08:04PM (#14075033)
> If you get in the habit of using the Spring test support, where classes under test get injected, then all kinds of injection are equally friendly, and the tests don't give you feedback on the weight of the dependencies because Spring does the heavy lifting.

How do you handle the Spring context start-up time? In Spring projects I've worked on, across hundreds of unit tests it's non-trivial. But I don't make any claim to know if we were doing Spring right or not.

Re:Spring vs. Java EE by twic on Monday April 10, 2017 @04:53PM (#14082446)
The context can be reused between tests. If you're not storing data in beans (which you normally shouldn't), this works well. There is a bit of subtlety in that the framework might have to create multiple context for different configurations, but each of them is reusable.

Running a single test is a bit of pain, but running the whole suite is not a lot slower than if it didn't use Spring.

Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @08:52PM (#14075221)
If you're firm on constructor injection, you can typically test the object in complete isolation without necessarily using mocks, without Spring having to be involved.

Or you can use mocks and Spring Boot's test annotations.

But with field/setter injection, that choice isn't as easy.

Re:Spring vs. Java EE by orless on Sunday April 09, 2017 @03:08PM (#14073822)
"... so usually these giant balls of mud are the result of project management and design mistakes, not the failure of the tool."

It is the failure of concepts so if the tool brings the right concepts, it helps avoid such design mistakes in the first place.

Re:Spring vs. Java EE by ivan_gammel on Sunday April 09, 2017 @03:42PM (#14074005)
That's too generic statement to be applied to anything. Some specific failures of tools (what exactly?) may be the cause of other issues, but it's not the law of nature. You can hit your finger by a hummer, but it's not because hummer brought the wrong concepts - it served millions of people to build their homes, their farms and fences, it's just because sometimes you miss the nail.
Re:Spring vs. Java EE by orless on Sunday April 09, 2017 @03:53PM (#14074044)
It is only generic if you completely drop the context of the discussion (Spring and dependency injection). My point is that Spring brings DI/IoC concepts which help build healthy projects.
Re:Spring vs. Java EE by ivan_gammel on Monday April 10, 2017 @01:57AM (#14076391)
There are so many counter-examples in the world of poorly built projects, that I don't really understand how did you came to this conclusion. DI/IoC is just a pattern, there's no way it could guide you to good architecture itself. Spring is just a tool, which adds some constraints, but which does not force you to make business decisions on scope of different domains or interaction between them that might lead to strong coupling and low modularity.
Re:Spring vs. Java EE by orless on Monday April 10, 2017 @08:16AM (#14077830)
I'm not sure where I stated that Spring forces "to make business decisions on scope of different domains or interaction between them that might lead to strong coupling and low modularity".
Re:Spring vs. Java EE by ivan_gammel on Monday April 10, 2017 @01:07PM (#14080389)
Let me explain in other words. You said: >It is the failure of concepts so if the tool brings the right concepts, it helps avoid such design mistakes in the first place. In the context of Spring/DI it does not make sense, because no matter what, some developers do and will be doing design mistakes related to coupling and modularity and some will write great code, but this is neither feature nor failure of the tool. DI/IoC is too low-level concept to influence application design, because in case of Spring it affects individual classes, not components, namespaces or subsystems. It is the responsibility of the developer to make decisions and create designs that make application modular, designs that restrict number of dependencies etc, and, in general, to do all the work required to avoid creating "giant ball of mud". The result of this work done with Spring or any other IoC/DI framework will not be very different from manual instantiation of objects and wiring.
Re:Spring vs. Java EE by twic on Sunday April 09, 2017 @06:48PM (#14074742)
I've spent multiple-year periods using each of Java EE, Spring, and no formal framework (in practice, Guice for DI, Tomcat/Servlets for web, lots of libraries, and lots and lots of homebrew stuff). I can say with confidence that if your goal is just to build a sophisticated application, there's no advantage to using the frameworks.

They include a lot of functionality, but beyond demo-scale applications, you will spend as much time fighting the framework as you save by using it.

The frameworks probably do save you time in getting started; Spring Boot certainly has a pretty smooth experience going from nothing to a running project with a controller, database, etc. But that's a tiny expense in the lifetime of a project.

EE might give you some kind of confidence that you can port your app between app servers (or different releases of an app server!). If you work in an environment where some idiot up the hierarchy has decided everyone should use app servers, that might be useful, but there's no point setting out to create such an environment.

Re:Spring vs. Java EE by taurath on Monday April 10, 2017 @04:57AM (#14076971)
In my experience an advantage of frameworks is that you can plop down a team with experience in that framework and have them be moderately productive quickly. I'd say they're a disadvantage in many cases depending on what type of app you're working on.
Re:Spring vs. Java EE by vbezhenar on Sunday April 09, 2017 @02:45PM (#14073712)
Both Java EE and Spring provide a huge amount of functionality and do it in an uniform way, so you don't have to glue lots of different libraries together. They aim for enterprise world, where this functionality is required. Not every project need it, so sometimes it might be not necessary. IoC is awesome on huge projects, but if your project is 10-20 classes, it's just unnecessary abstraction. Distributed transactions increase robustness, when you're working with multiple databases and message queues, but if you're creating website with a single database, you just don't need it. WebServices implementation is a must, when you have to integrate with someone, who's exposing their API via webservice and you'll drown in details, if you'll try to implement it manually, but if you're using lightweight REST APIs, it's quite possible to do it without any frameworks.

So it's good when you need it, and it's unnecessary over-engineering for simple projects.

Re:Spring vs. Java EE by orless on Sunday April 09, 2017 @03:19PM (#14073881)
Whether IoC is reasonable or not does not depend on the number of classes in the project. It is still a useful pattern even if you have, like, 3 classes (component A using implementation B of the interface Ib). It's just if you have only few components, you may want to wire them manually in maybe 10 lines of code instead of dropping in Spring JARs.
Re:Spring vs. Java EE by shouldbworking on Sunday April 09, 2017 @02:41PM (#14073695)
It is daunting for sure. I stewed myself in the ecosystem last year by writing a couple open source libraries and fell in love with it. Java was the sexy language of the 90's, ironic because The best way I can describe it is the exact opposite of the current sexy language, JavaScript.

Java is great, the best, when I'm trying to build something creative. It's like having access to an entire parts warehouse vs a toolshed for most other languages. Unlike especially JS, most libraries are well tested and most people agree on doing things a certain way. There's not a lot of unknowns, almost no flux, and once you know the rules you can focus on your problem and ignore the "ecosystem" almost entirely.

The complexity can be looked at from a different perspective, I see it as similar to Roman characters vs Chinese. Learning 26 characters is a hell of a lot easier but with a couple thousand you can say the same things with a lot less writing. Once you've gotten over the cognitive hill of learning the complexity it doesn't really get in the way. It's there when you need it, and you ignore it when you don't.

Contrast this to JavaScript where most advancements redefine workflows or parts of the language core libraries. It feels like the most exciting thing about JavaScript is how unstable it is, something that scares the hell out of me after working on 15+ year old code. What you trade off with complexity in Java is definitely less work than keeping up with js for more than a year.

This sort of became a js/Java comparison because there's a ton of similarity in the hype between them and their lifecycle so far. Java was not always so complex after all. You can see the complexity of the JS ecosystem and language growing steadily and I have no doubt that in five years it will be just as complex as Java. The complexity is driven by the big guys that actually need it, and being the big guys, they also have the most influence on what the language eventually becomes.

So to recap, no, for the vast majority of projects the complexity is definitely not justified. It's there so the language can support the 1% of projects that need all that. On the other hand, once you know your way around it's fairly easy to ignore those parts. What access to all this stuff really gives you is power. As a footnote, give JS some time and it will be the same. Any language picked up by corporate interests is basically destined for overengineering.

Re:Spring vs. Java EE by pjmlp on Monday April 10, 2017 @05:30AM (#14077097)
> Any language picked up by corporate interests is basically destined for overengineering.

I saw plenty of overengineering even with C back in the 90's.

My biggest example was a server framework that used its own concept of opaque pointers all over the code, because they abstracted data access over shared memory to all instances of the server.

So any memory access to data structures storing server state required translating between handles and pointer all the time.

Re:Spring vs. Java EE by reitanqild on Sunday April 09, 2017 @02:02PM (#14073509)
JavaEE provides a lot of the stuff programmers like me want in a way that is more or less consistent between different vendors.

Typically this includes database access, ORM, message bus access etc.

It also does so in a very integrated way so you can easily have for example a transaction that spans database modification and sending to a message bus.

I like it. I found that embracing it allowed me to simplify lots of code.

Re:Spring vs. Java EE by nugator on Sunday April 09, 2017 @02:07PM (#14073530)
Depends on what you're trying to solve. If you need to use a database, serve or get data over HTTP, run things every hour etc. chances are you'll save time and have a more stable and performing solution by using libraries from other parties. For example Spring libraries.
Re:Spring vs. Java EE by sz4kerto on Sunday April 09, 2017 @01:59PM (#14073496)
Distributed transactions, queues, clustering, ORM, messaging, batch processing, web services, etc. All ​built-in, mostly working well and documented.
Re:Spring vs. Java EE by jamesblonde on Sunday April 09, 2017 @02:11PM (#14073555)
And TLS/SSL, authentication using either LDAP, client-side SSL certs. Custom filters for REST endpoints (Aspect/J-like). We build our angularJS frontend against a Java EE backend. Works really well - we use ssh scripts to copy javascript/html changes to the app server instead of redeploying, means its 2 seconds between html/js changes and viewing it on the app (like it should be). Can be done.
Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @02:32PM (#14073650)
All supported by Spring as well, sometimes interchangeably with, or adapting to, Java EE alternatives.
Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @02:21PM (#14073604)
I'll put my disclosure up-front: I work for Pivotal on a Cloud Foundry project. Pivotal employs many members of the Spring team. I am not speaking for either Spring or Pivotal.

Both Spring and Java EE are very featuresome because of a long period of evolution across multiple partial paradigm shifts (3-tier, CORBA, Web 1.0, App Containers, SOA, VMs, Web 2.0, Containers...).

I'm personally only familiar with Spring. And by "familiar" I mean I've learnt enough to be dangerous. But I've also learned to ask, before doing something: "Have the Spring team already solved this?"

Take, for example, retrying an operation. A slightly hacky way to achieve this is to nest try-catches. A slightly less hacky way is some sort of loop. Then we extract this functionality out. I dunno, lambdas maybe?

Or: I could use Spring-Retry[0].

That's just one example from my own experience.

It used to be that Java EE was it. And it had to be: the mega-buyers insisted that there were sufficiently rigorous standards that they could switch vendors. Every giant corporation bleeds gold to some ancient vendor and they have an immune reaction, nearly a spasm allergy, to vendor lockin[1].

Opensource tools kinda sail around this, because ... uh ... what vendor lockin? Who has you grasped, by what kind of delicate hair? Nobody. It's opensource. You can wait for community action, or engage a consultancy, or a related product company, or hire specialists, or sponsor something ... you have a wider range of options.

Oh sure, there's tech lockin, but that's true of any decision. Either you exploit the features of a platform and tie yourself to it, or you write a rubber-room abstraction layer and tie yourself to that instead, but at your expense.

In my observation as a 1st? 2nd? party, the Spring team pay close attention to the standards and support them. And, not coincidentally, many standards look -- gee, just awfully similar to something Spring had road-tested a few years prior.

I think a lot of the shade thrown in this debate is happening because of money. Pivotal backs Spring very strongly, because it helps to sell our version of Cloud Foundry (imaginatively: Pivotal Cloud Foundry).

Meanwhile, Oracle owns a lot of Java products, some inherited from Sun, as well as being the stewards of the Java EE standards process. Red Hat own a solid suite of Java EE-capable and platform products, a portfolio largely overlapping with Pivotal's, IBM's and SAP's.

In each of these cases there's a zero-ish sum-ish game underway. A company that bets on Red Hat doesn't bet on IBM. A company going all-in with Oracle (RIP your chequebook) isn't going to buy much from Pivotal.

Meanwhile, the Spring team are just writing software. I lurk some of their internal Slack channels. It's almost exclusively technical and usually very thoughtful. As a Pivot indoctrinated by Pivotal Labs, I appreciate having a very different example of how to develop high-quality software.

[0] https://github.com/spring-projects/spring-retry

[1] You will often find companies accusing each other this.

Re:Spring vs. Java EE by kazagistar on Monday April 10, 2017 @02:02AM (#14076404)
> "Have the Spring team already solved this?"

Almost every time the answer for me has been "it seems like they have, but they don't handle a critical edge case of some kind and cannot be extended to, and thus their solution is totally useless."

Re:Spring vs. Java EE by jacques_chester on Monday April 10, 2017 @07:29PM (#14083488)
I've had this experience too, sometimes.

I have also found them responsive to feedback.

Re:Spring vs. Java EE by twic on Sunday April 09, 2017 @06:47PM (#14074738)
> Or: I could use Spring-Retry[0].

The idea that you would add a dependency to avoid writing a try-catch in a loop is absolutely bewildering to me. What next, Spring Pad? I can see it now:

  @LeftPad(width = 50)
  public String getNameForDisplay() {
    return name;
  }
Re:Spring vs. Java EE by jacques_chester on Sunday April 09, 2017 @08:49PM (#14075198)
> The idea that you would add a dependency to avoid writing a try-catch in a loop is absolutely bewildering to me.

Reliable retry is very important in some cases, and it's easier to test a retry-agnostic unit of code.

Edit: and I also rather like that it's declarative, rather than needing to infer intention or write my own boilerplate to explicate intention.

Re:Spring vs. Java EE by nimish on Sunday April 09, 2017 @07:50PM (#14074983)
Being able to quickly change in different retry mechanisms and policies is pretty useful. Sometimes you want exponential backoff, sometimes no backoff, sometimes it depends on other state.

Not as simple as you might think. And if you're gonna be writing microservices you're going to be intimately familiar with retries.

Re:Spring vs. Java EE by wsargent on Monday April 10, 2017 @02:43PM (#14081348)
I really like jhalterman's failsafe library. Exponential backoff, jitter, circuit breaker support, etc.

https://github.com/jhalterman/failsafe

Re:Spring vs. Java EE by springsux on Monday April 10, 2017 @12:11AM (#14075951)
Death by a thousand annotations, which used to be death by a thousand XML files.
Re:Spring vs. Java EE by springsux on Monday April 10, 2017 @12:10AM (#14075947)
> Meanwhile, Oracle owns a lot of Java products

That doesn't make Oracle bad or Pivotal good.

Re:Spring vs. Java EE by jacques_chester on Monday April 10, 2017 @07:30PM (#14083494)
Not what I intended to convey. I am saying that Oracle, like Pivotal and Red Hat, is interested in the relative balance of Spring and Java EE preferences in the community.
Re:Spring vs. Java EE by snambi on Sunday April 09, 2017 @04:16PM (#14074144)
I used to like spring in favor of JEE Application servers. But of late, spring is getting too bloated, too complicated and buggy. OTOH, newer java frameworks are simpler and easier to work with. For example, spark application framework or retrofit for rest APIs. At this point spring is very similar to JEE.