BT

Spring Boot 1.3 Released Featuring DevTools and ASCII Art

| by Matt Raible Follow 13 Followers on Dec 04, 2015. Estimated reading time: 9 minutes |

Spring custodian Pivotal has released Spring Boot 1.3, which adds hot reload support of Java classes/Spring configuration (using a new spring-boot-devtools module), cache auto-configuration (for EhCache, Hazelcast, Infinispan, JCache, Redis and Guava), and fully executable archives for Linux/Unix. The release has extensive release notes detailing all of the changes.

One nifty new feature is that your banner.txt files can now include ANSI color codes. This means you can show art in your console logs when your app starts. For example:

Spring Boot ASCII Art: Cat

Or the one from the latest release of JHipster:

Spring Boot ASCII Art: JHipster

If you'd like to get creative with this feature, Craig Burke created an image to ascii-art converter for Spring Boot.

InfoQ sat down with top Spring Boot team contributors Dr. Dave Syer, Phillip Webb, Stéphane Nicoll, Andy Wilkinson, and Josh Long for a Q&A session about this release.

InfoQ: Spring Boot seems like a popular project. Have you been happy with the Java community's response to it?

Spring Boot team: Very much! We think that there are a couple of factors that helped boost Spring Boot's popularity. The first is that Java 8 really helped trigger a mini-resurgence with Java in general. Compared with Java 7, coding in Java 8 is a lot of fun! The second is the great foundation that already existed for Spring Boot to build on. The Spring ecosystem can be quite large, and a lot of people might not have invested the time to look into all the different projects available. By making it quick and easy to kick the tires, we can highlight features that you might have otherwise overlooked. Our favorite example of this is probably Spring Data + Hibernate + In-Memory DB. By removing the need for all that explicit configuration, it becomes so much easier to show the real power of Spring Data repositories. You're almost getting to dynamic language levels of productivity, but with the type safety, concurrency, stability and the performance of the JVM.

InfoQ: What are your favorite features in Spring Boot 1.3?

Spring Boot team: We've joked a bit internally that we've spent eight months working on features such as devtools, caching, metrics and more auto-configurations, but the thing that people like the most... color banners! Probably one of the more unique features, and something we haven't seen elsewhere is fully executable JARs. The ability to just create a unix service by typing ln -s is pretty nice.

InfoQ: This seems like a large release, why not name it 2.0?

Spring Boot team: The Spring Framework has always had fairly conservative version numbering, after 10+ years it's only at version 4. We wanted to continue that tradition and also send a signal that this should be a fairly painless upgrade for most people. We'll release version 2.0 when Spring 5.0 is out and Java 8 is a minimum requirement.

InfoQ: Are there any plans to reduce the memory footprint required by Spring Boot apps?

Spring Boot team: Reported memory usage for Spring applications can sometimes be a little misleading. We've had a few false reports raised in the past driven by the fact that internal caches are consuming memory and haven't yet been GC'd. The Freemarker sample application in the Spring Boot repo, for example, runs quite happily on Java 8 with -Xmx32MB (although it does use use a fair chunk of non-heap memory). Some refinement of the cache logic in the Spring Framework did happen recently, and there are plans to revisit this again. Any sample applications that readers could share to demonstrate extreme memory usage will helpful here.

InfoQ: What's the best way to orchestrate (deploy, monitor, replace) Spring Boot microservices in the cloud (e.g. AWS, Cloud Foundry, Heroku)?

Spring Boot team: Spring Boot runs well on pretty much everything. Heroku, OpenShift, Google Cloud, Oracle Cloud, Azure, etc., have all done public blogs or talks on how to run Spring Boot (and, often, Spring Cloud) applications on their platforms. We even document the process in the Spring Boot reference guide for a few large cloud platforms. If you're trying to assemble your own orchestration and platform (don't!), then you'll find we have guides on using Docker and Spring Boot together on http://spring.io/guides.

For most people, though, we honestly think that Cloud Foundry is hard to beat, cf push -p foo.jar foo and you're done. The work that the Spring Cloud team have done to integrate Netflix OSS with Pivotal Cloud Foundry is also amazing.

InfoQ: Do you see any features in Java 9 or Java EE 8 that might help Spring Boot?

Spring Boot team: Depending on its final shape, JDK 9's module system may turn into a foundation for modular Spring applications. Spring Framework 5 will do everything it can to allow applications to be based on JDK 9 modules... and so will Spring Boot 2, in particular with respect to consistent modulepath-based startup of the JVM, avoiding the good old classpath completely.

As for Java EE 8, we're seeing a lot of interest in HTTP/2. While it's possible to use HTTP/2 today with Spring Boot (it's already supported by both Jetty and Undertow), having official support for it in Servlet 4.0 will be very welcome. Other Java EE 8 specifications will be supported as demand calls for them. We imagine that JMS 2.1 will be in high demand. Interestingly, Spring Boot already offers JCache 1.0 support and Spring Framework already supports Hibernate 5.0. We still need to do some work with Spring Boot to fully support Hibernate 5.0 which should hopefully happen in 1.4.

InfoQ: Can you suggest some helpful videos for beginners to get started with Spring Boot?

Spring Boot team: Brian Clozel and Stéphane Nicoll did a recent Devoxx talk that's already online. It's a much longer talk than most conference recordings so it can go into quite a bit of detail. Phil Webb did a talk with Josh Long in 2014 that was fun and will give you a general idea of Spring Boot features and Josh did a great solo talk with more of a microservice theme that's on vimeo.

InfoQ: Are there any videos you'd recommend for advanced Spring Boot users?

Spring Boot team: Spring Boot for DevOps by Nicholas Frankel has a lot of useful information and covers some extension points that more advanced users might be interested in. After that I'd suggest looking at some of the Spring Cloud talks. Dave Syer and Josh Long have a nice introduction talk and you should also watch Jon Schneider and Taylor Wicksell talk about Spring Cloud and Netflix (this was one of the highest voted talks from this year's SpringOne2GX conference).

InfoQ: Does start.spring.io gather any statistics about starter packages chosen by users? If so, do you have any you can share?

Spring Boot team: Yes we collect statistics and we have described some of them in a recent blog post. We can see a clear domination of Maven-based projects using Java 8 with jar packaging. start.spring.io generates 50.000 projects a month on average and we envision to provide more statistics on a regular basis.

InfoQ: The color banner.txt is an interesting and fun feature in Spring Boot 1.3. Do you have any plans to end coloring to logging so different log levels render in different colors?

Spring Boot team: Changing the color based on the logging level is already supported in 1.3. We use it in the default console logging configuration to color code the level: INFO is green, WARN is yellow and ERROR is red. You could change that to color the whole line if you want using the %clr conversion word. Something like this:

    %clr(%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%15.15t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx})

The reason we don't do that by default is that it can make the logs pretty unreadable with some terminal themes.

InfoQ also spoke with Julien Dubois, founder of JHipster, used to create AngularJS Spring Boot projects. Dubois is a long-time user of Spring Boot and as we expected he had a unique perspective as a power user.

InfoQ: When did you first start using Spring Boot?

Julien Dubois: JHipster was started a couple of months before Spring Boot existed, and we had some initial goals that were pretty close to what Spring Boot currently provides.

In November 2013, I had lunch with my friend Josh Long who was on holidays in Paris. While having coffee at a Starbucks, he introduced me to Spring Boot: I immediately saw that it would greatly help JHipster, and that replacing our custom Spring code by Spring Boot would be a tremendous step forward for the project. A couple of years later, I'm happy to say it was the right decision!

InfoQ: What's your experience been like when upgrading between Spring Boot versions?

Dubois: Upgrading Spring Boot versions usually takes some time, as we are quite tightly integrated with it. As we are using the Maven BOM (Bill Of Materials) provided by Spring Boot, we need to check that upgrading it works fine for us: it usually does, but we can have a few third-party dependencies that cause trouble and need to have some specific version number. New Spring Boot versions also provide new features, for example new health checks or new automatic configurations: in that case, our main task is to integrate them, remove some of our existing code that was doing the same thing, or maybe add a graphical interface on top of it.

One great example is the Cassandra support that comes in Spring Boot 1.3, as it was my code from JHipster that was included in Spring Boot. Obviously we had to delete all the code from JHipster to use the one provided by Spring Boot! This is great for us, as this kind of technical code is clearly not in JHipster's scope, and we only add it to the project when we don't have any better solution.

InfoQ: What are your favorite features in Spring Boot 1.3?

Dubois: There is definitely one feature I love in Spring Boot 1.3, it's the new devtools!!! We have had a very hard time trying to have hot reload working with JHipster: have a look at our JHipster Loaded project, which is now defunct, at https://github.com/jhipster/jhipster-loaded . That was really a lot of work, we spent weeks on this, and the end-result was quite buggy. The new Spring Boot devtools solve this very nicely, and without as many bugs! The overall experience is excellent for our end-users, as they have both the front-end updated by BrowserSync and the back-end updated by Spring Boot devtools. That gives this incredible feeling of having everything updated automatically all the time, which is very nice to work with, and very surprising for people coming from classical Java development environments.

InfoQ: Is there any particular feature you'd like to see added to Spring Boot?

Dubois: This is more of a long-running issue with Spring for me, but I'd like to have a better start-up time. Devtools have solved this problem at development time, but for many cloud providers the start-up time is also very important. For example, some Spring beans could startup asynchronously: that's in fact what we hand-coded for our Liquibase support, and that has made our overall startup time drop by around 40%. This could be made a lot smarter, of course, to use all the available CPU cores available the best way possible.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT