Beginning Spring 5 by Joseph B. Ottinger & Andrew Lombardi

Beginning Spring 5 by Joseph B. Ottinger & Andrew Lombardi

Author:Joseph B. Ottinger & Andrew Lombardi
Language: eng
Format: epub
ISBN: 9781484244869
Publisher: Apress


7.1 What Is Spring Boot?

Spring Boot can be defined in many ways, just like Spring can be defined in many ways.

At its heart, it’s a project that combines many of the most commonly used bits of Spring into a single cohesive unit such that dependencies are easier to manage, as well as an executable environment to make deployment without a container quite doable.

We haven’t really run into enough correlated dependencies to give ourselves a headache with trying to chase down problems in our dependencies, although as we’ve progressed we’ve added more and more modules to our chapter projects. So far we’ve been laser-focused on each chapter’s topics such that we’ve been able to keep dependency lists to a fair minimum. Even so, there are a few issues we’ve encountered – although we haven’t needed to address them, because they’re so minor, and our tools actually fix them for us.

Namely, in Chapter 6, we used jtwig-spring for rendering our “Hello, World” content. This library actually has transitive dependencies itself, on spring-webmvc, guava, jtwig-web, slf4j-api, and commons-lang. The “issue” – note scare quotes! – is that the dependency on spring-webmvc contained by the jtwig-spring artifact is actually on version 4.2.3.RELEASE and not the Spring 5 version of spring-webmvc. Gradle actually allows us to override the versions easily; when we declare the dependency ourselves, Gradle assumes that we want the specific version we are referring to instead of a transitive dependency, and thus it overrides the transitive dependency with the right version.

With the Spring Boot parent project, we coalesce many of the Spring dependencies into one reference list and thus eliminate a host of potential problems in one fell swoop. This has implications for our library declarations and testing, since almost everything is made available by magic.1

But there’s more.

Spring Boot is designed to give you the ability to make your projects executable without a container like Apache Tomcat. You can still write your controllers and Spring beans the exact same way, but instead of starting a Tomcat instance and deploying your web application into it (a process we are more or less pretending to do when we use gradle tomcatStartWar), Spring Boot can be executed as a regular executable Jar file. It embeds a web container itself (Tomcat, by default) and manages it; it also manages logging, database connections (and database setup), configurations, metrics, and other things.

It can be horribly convenient.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.