News for hackers. Stuff that matters.
Re:Java 12 by rb808 on Tuesday March 19, 2019 @05:59PM (#19436468)
Ironicaly I'm the other way around. Java is a pretty good platform, save the GC pauses.

However I really dont see what benefits Spring brings. Spring Boot is great for prototyping and trivial apps, but for big systems you really want to break it apart. DI is better done with ServiceLocators. Some of the smaller libraries like Spring Shell, Spring Mobile are junk. And I still see lots of XML config that you dont know if they'll fail until you try to run them.

Re:Java 12 by sabareesh on Tuesday March 19, 2019 @06:56PM (#19436994)
I am not sure what else are you looking for, Spring boot/cloud has pretty much all you need to build any application.
Re:Java 12 by MarkMc on Tuesday March 19, 2019 @08:27PM (#19437644)
I know Spring and Spring boot are very popular, but I don't understand why. The Spring Boot home page says, "Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run"."

What does that mean? What does Spring Boot give me that Tomcat doesn't?

Re:Java 12 by sbov on Wednesday March 20, 2019 @12:03AM (#19438854)
What code are you writing that Tomcat runs? Are you coding against the servlet spec? Or are you using something like dropwizard?

Tomcat is a servlet container that implements various Java EE specifications, such as the servlet spec, jsp spec, etc.

Spring encompasses many different libraries. The most widely used is probably Spring MVC, which builds on top of the servlet spec to make building web applications easier. After that Spring Security is probably most widely used, which adds things like auth, CSRF tokens, etc. Spring Data and Spring Cloud are also somewhat popular. There are many more Spring libraries, but I have little to no experience with them.

You can really give or take what you want here. You can use Spring MVC with Spring Data, or Hibernate, or JPA, JDBC, or whatever you want really. One place I worked used Spring MVC with home grown security and ORM layer.

Spring Boot brings "convention over configuration" to Spring. Because Spring is so configurable it can take a lot of boilerplate. Spring Boot removes much of that boilerplate for certain use cases and has, generally speaking, more user friendly defaults.

Spring Boot also runs off a server embedded in the jar. That's why you can "just run" it. You create a "Main" method. You can choose from several embedded servers, including Tomcat. But this isn't exactly special for Spring Boot because you could do this even if you didn't use Spring Boot.

Re:Java 12 by MarkMc on Wednesday March 20, 2019 @12:30AM (#19439003)
Thanks - that's a good overview :)

Most of my apps just code against the servlet spec with a JDBC connection to a MYSQL database, sometimes with JSP. Perhaps because most of my business logic lives on the client I've usually found that plain servlets + plain JDBC calls were sufficient

Although I've found it pretty straightforward to configure servlets in Tomcat I can see that Spring MVC makes it a little easier. Maybe the introduction of a framework 'Model' is also an advantage - I'll investigate further.

Regarding Spring security - would I use this package if I was implementing a "Login with Email/Password or Facebook or Google" feature to a website?

Re:Java 12 by jacques_chester on Wednesday March 20, 2019 @07:55AM (#19441163)
One nice thing about Spring Boot is that you can mix and match. You can assemble stuff very quickly using the starters, or you can use your own stuff. Pretty much any level of abstraction is supported -- Spring Data spans the range from "thin convenience wrapper over JDBC" (JDBCTemplate) to "completely autogenerated RESTful endpoints based on JPA models" (Spring Data REST). In web land you can use raw servlets up to fully-dressed domain objects. Whatever you want, Spring can either fill in the gap or politely yield the floor.

Not forgetting that dependency injection -- the original core feature -- is just the bee's knees.

I work for Pivotal, but not on Spring. But I've definitely grown to appreciate it more and more over the years. I deeply miss it when mucking about in Golang.

Re:Java 12 by rb808 on Tuesday March 19, 2019 @10:22PM (#19438318)
I only need to run a few different applications and they require very little boilerplate to get this to work. Spring just gets in the way and makes simple things complicated.
Re:Java 12 by jimbokun on Tuesday March 19, 2019 @06:13PM (#19436610)
"Spring Boot is great for prototyping and trivial apps, but for big systems you really want to break it apart."

Any practical advice for making this happen? I have a Spring Boot system I wrote and am responsible for, but now I just want the pain to stop.

Re:Java 12 by spricket on Tuesday March 19, 2019 @09:56PM (#19438171)
You need to take the library approach. It's much like react vs angular. With angular, and spring, you get a ton out of the box but much is mediocre.

Like React, you can out together your own "best of breed" java stack. It just takes a lot more work.

Look to replace one component at a time. For DI Guice or Dagger2. For REST Vert.X or Jersey. Logging Logback. Metrics, DropWizard Metrics. OAuth ScribeJava. Hibernate for Spring Data.

Take a look at the "awesome java" repos and choose your poison.

I'll warn you now that while you can end up with something far better you lose the coherency of Spring. Of your organization doesn't have a good "apprentice" setup all the new devs will be utterly and hopelessly lost. And good luck finding a Dev that knows 20+ libraries vs "Spring".

Rolling the libs was worth it for us but probably not a lot of eng orgs

If you're just looking for a drop-in Spring replacement you can't go wrong with DropWizard. It's a solid combo of best-of-breed libraries and has quiet support/adoption by many huge companies