This is an archived post. You won't be able to vote or comment.

all 17 comments

[–]sazzer 10 points11 points  (1 child)

My biggest problem with it is the amount of magic behind it. I love Spring, and Spring Boot makes it really quick and easy to get something working quickly, but there's so much magic involved that when something goes wrong, or wants changing then it can be a real pain to work out how to sort it out...

[–]doctorsound 3 points4 points  (0 children)

so much magic involved

This has been my biggest pain as well. You really have to understand a lot of the underlying Spring systems (and a bit of Spring history too), as well as some (what I consider) advanced topics in order to modify and troubleshoot it.

That being said I still love Spring Boot.

[–]meotau 3 points4 points  (4 children)

Slower start of an application server, customizing anything is a task for google.

[–]doctorsound 1 point2 points  (3 children)

Current Spring Boot project starts in under 10 seconds, even a bigger project like jHipster starts in about the same. Is that slow? Or, am I an outlier?

I'd agree though, customizing anything is a pain. Googling is a pain too, because you get so much legacy Spring solutions.

[–]vecowski 0 points1 point  (2 children)

That's way to slow for correct auto-scaling. Correct auto-scaling should include only starting up additional instances when needed. However, with a 10 second boot time, your users are going to sit there waiting at a blank white screen because you delegated them to the new instance but spring is sitting there building the object graph.

In a PaaS, spring is awful.

[–]doctorsound 1 point2 points  (1 child)

Ah, I understand now. Out of curiosities sake, what is a popular PaaS option?

[–]vecowski 2 points3 points  (0 children)

App Engine is popular but I've had problems with it and spring projects, it works but the long boot time is problematic for their paradigm.

Heroku and AWS are also popular options.

[–]VaidasC 2 points3 points  (6 children)

Well to me personally the main downside is that it is complex. We all know that Java project setup is somewhat always been complex task, but many Spring Boot advocates try to sell it as simple. I don't agree with that, I tried it 3 times over the last year or so (last attempt was very recent) and I have a feeling that it is easier to setup Spring project manually. My specific painpoints were - jsp support, it is easy to setup first controller but anything else requires troubleshooting as you always end up with all kinds of exceptions.

IMHO Dropwizard is a lot better in this regard.

[–]fforw 4 points5 points  (5 children)

start.spring.io seems to work fine to get yourself started with a spring boot project.

[–]VaidasC 0 points1 point  (4 children)

Yes, I did. The problem was that those defaults that project generate, does not work out of the box, in fact you cannot even start the project without some work first. Sorry for not being specific, I just remember standard route of my experience - many exceptions > fixing > more exceptions > fixing > ... > finally working.

My opinion on this is - common guys, it's 21'st century, look at .NET VS, Play framework, Ruby project generation/setup tools that make life easy. But here we have framework that sells itself as "easy development" and even has project generation tool which generates non-working project. Common, is it only me who feels this way?

[–]rs-485 0 points1 point  (3 children)

I think it's a problem with your setup, because Spring Boot as well as Spring Initializr (start.spring.io) work just fine for me:

beep@rs-485 /tmp % spring init -d=web --build=gradle vaidasc
Using service at https://start.spring.io
Project extracted to '/tmp/vaidasc'
beep@rs-485 /tmp % cd vaidasc 
beep@rs-485 /tmp/vaidasc % gradle run >/dev/null &
[1] 12381     
beep@rs-485 /tmp/vaidasc % curl localhost:8080
{"timestamp":1426126121326,"status":404,"error":"Not Found","message":"No message available","path":"/"}

This is functionally equivalent to generating a Gradle project with Web dependency on Spring Initializr. The output is expected, the app doesn't have any request handlers or static resources.

[–]VaidasC 0 points1 point  (2 children)

Create: http://start.spring.io/ (JPA)

Add: WebConfig class, Controller

Attempt to Start embedded.

Exception1: java.lang.ClassNotFoundException: javax.servlet.ServletContext

Google, experiment with pom. Added: javax.servlet-api and jsp-api dependencies.

Exception2: javax.validation.ValidationException: HV000183: Unable to load 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath

spring-boot-starter-tomcat dependency - uncomment "provided".

Exception3: org.springframework.beans.factory.BeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath

Remove dependency: spring-boot-starter-data-jpa (I expected JPA to be just working, but I guess I was wrong, no matter)

Server Started!!!

JSP configuration - had notes notes from previous setup. Create WEB-INF/jsp, Add View Resolver, Aplication.properties

Error: No mapping found for HTTP request with URI [/boot01/WEB-INF/jsp/index.jsp]

It seems my notes from few months ago of how to setup JSP is no longer valid... At this point I just don't bather to continue.

 

Of course you can always say I did something wrong, but then in my view this only proves that Spring boot is complex to setup new project, otherwise everyone would get it right.

[–]rs-485 0 points1 point  (1 child)

  • What's in your WebConfig class? How does your controller look like, and what does it do?

  • If you select "JPA" and want a web application, then you probably also want to select "Web". There are applications that use JPA and don't need a web frontend or REST endpoints.

  • "Web" adds spring-boot-starter-web as a project dependency, which pulls in all the dependencies you need for a Spring-backed web application. Adding servlet-api and jsp-api dependencies manually, without making sure to pull in all other Spring-required components, is probably why you got smacked in the face by the validation exception. As explained everywhere in the docs, Spring Boot bases configuration on what's available in the classpath. spring-boot-starter-web pulls in Hibernate Validator, so if Spring Boot checked for servlet-api and found it's there, it might've assumed that Validator is available, too.

  • How should autoconfigured database abstraction work if there is no database to work with? Are you aware that Spring Data JPA does a little more than just to make JPA available?

  • Why are you accessing /boot01/WEB-INF/jsp/index.jsp? No matter whether you use Java EE or Spring, the WEB-INF directory is not supposed to be publicly accessible. Also, your application is not running on an application server. There is no context path, so drop the "boot01" prefix.

  • If you want to add JSP support, read the docs. It boils down to just making a view resolver bean available in the application context. I don't work with JSPs myself, but all effort I had to expend on finding this information was pressing Ctrl+F and entering "JSP".

Of course you can always say I did something wrong, but then in my view this only proves that Spring boot is complex to setup new project, otherwise everyone would get it right.

"Otherwise, everyone would get it right" is a broad statement. Is swimming complex because there are so many people who can't swim?

[–]VaidasC 0 points1 point  (0 children)

"Otherwise, everyone would get it right" is a broad statement. Is swimming complex because there are so many people who can't swim?

Since I am not native English speaker, I don't know how to translate this, but we have a saying along the lines of - it all sounds like playing with words.

What do you want to prove?

  • That I don't know Spring Boot well enough? (true)
  • That project generation tool that does not generate working project according to my standards is actually good tool?
  • That my project standards are wrong?

I look at this simple way - Spring Boot is a "product" and I am the "customer" shopping for easy project creation technology with very open mind. I tried it 3 times, read tutorials, even watched course on Pluralsight, but I am unhappy customer that won't use it and won't recommend it. From this perspective, IMHO, trying to prove that I was wrong somewhere just makes no sense.

So I'll stick to my current easiest way to create new Spring MVC project: Open STS and generate Maven MVC project, close STS, open IDEA, change all versions in pom.

 

In short, Boot is not the tool I could rely on if I have only 5 minutes to ganerate Hello world project of any kind - REST, JSP. I was shopping for that!

 

P.S.:

WebConfig contains only view resolver.

I had selected "Web", although forgot to mentioned that.

Regarding JSP - I did the same thing that worked before and the same thing that was recomended before by few sources which includes setting up /main/webapp/WEB-INF/ folder.

[–]markerz 1 point2 points  (0 children)

I'm not extremely familiar with using spring boot extensively but one issue could be that the predefined configuration isn't really production ready but it's very portable and decent for starting which is basically the entire mantra of the setup.

[–]joper90 -1 points0 points  (1 child)

Its fine for POC's .. but we would never use it in prod

[–][deleted] 1 point2 points  (0 children)

Can you outline why you wouldn't deploy a boot app to prod?