Swipe to navigate through the chapters of this book
So far, we’ve looked at dependency injection and various configuration approaches, and we’ve explored deploying some web services into Apache Tomcat. Along the way we’ve used a small set of Spring modules, picking and choosing as needed. It’s time for us to switch gears and look at Spring Boot, which is a project structure generally aimed at microcontainers; Spring Boot gives us an easier way to get larger feature sets out of Spring and offers an integrated set of services aimed at deploying running applications without having to rely on traditional Jakarta EE services like Apache Tomcat.
Please log in to get access to this content
True story: There was a chapter in which testing was such a pain without Spring Boot that your authors decided to move the chapter to be after the Spring Boot chapter so that Boot’s tooling could be used.
We could have used Chapter 6’s classes in this chapter, but Chapter 6 doesn’t use Spring Boot and this chapter does, obviously enough. This means Chapter 6’s classes would imply dependency management issues that we’re trying to avoid here, so we’re going to rewrite the classes for clarity’s sake, as well as illustrating some different concepts.
Be careful about dependencies here. There’s an org.springframework:spring-jdbc dependency as well, but it will use an embedded database url by design, overriding any database connection properties you might set manually.
There’s nothing wrong with an embedded database, but note that embedded databases are fast but not typically scalable. If your application gets enough traffic that a single application container gets overwhelmed, you’d need to rebuild the database to point to an external database. It’s not a high-priority thing to think about, but it is important to be aware. Embedded databases are great, because of how easy they are to use, but they’re certainly not a “one stop solution.”
Accessors and mutators are commonly called “getters” and “setters,” respectively, in case you don’t recall us mentioning this – but this author still finds the use of “getter” and “setter” rather unacceptable in polite company.
- Spring Boot
Joseph B. Ottinger
- Sequence number
- Chapter number
- Chapter 7