第二章: 开发你的第一个SpringBoot应用程序
本章内容:
- Working with Spring Boot starters
- Automatic Spring configuration
When’s the last time you went to a supermarket or major retail store and actually
had to push the door open? Most large stores have automatic doors that sense your
presence and open for you. Any door will enable you to enter a building, but auto-
matic doors don’t require that you push or pull them open.
Similarly, many public facilities have restrooms with automatic water faucets
and towel dispensers. Although not quite as prevalent as automatic supermarket
doors, these devices don’t ask much of you and instead are happy to dispense
water and towels.
And I honestly don’t remember the last time I even saw an ice tray, much less filled
it with water or cracked it to get ice for a glass of water. My refrigerator/freezer some-
how magically always has ice for me and is at the ready to fill a glass for me.
I bet you can think of countless ways that modern life is automated with devices that work for you, not the other way around. With all of this automationeverywhere, you’d think that we’d see more of it in our development tasks. Strangely,that hasn’t been so.
Up until recently, creating an application with Spring required you to do a lot of work
for the framework. Sure, Spring has long had fantastic features for developing amazing
applications. But it was up to you to add all of the library dependencies to the project’s
build specification. And it was your job to write configuration to tell Spring what to do.
In this chapter, we’re going to look at two ways that Spring Boot has added a level
of automation to Spring development: starter dependencies and automatic configura-
tion. You’ll see how these essential Spring Boot features free you from the tedium and
distraction of enabling Spring in your projects and let you focus on actually develop-
ing your applications. Along the way, you’ll write a small but complete Spring applica-
tion that puts Spring Boot to work for you.