12 Using data sources in Spring apps
This chapter covers
- What a data source is
- Configuring a data source in a Spring app
- Using JdbcTemplate to work with a database
Almost every app today needs to store data it works with. And most often, apps use databases to manage the data they persist. For many years, relational databases have provided applications with a simple and elegant way to store data that you can successfully apply in many scenarios. Spring apps, like other apps, often need to use databases to persist data, and for this reason, you need to learn how to implement such capabilities for your Spring apps.
In this chapter, we discuss what a data source is and the most straightforward way to make your Spring app work with a database. That straightforward way is the JdbcTemplate
tool that Spring offers.
Figure 12.1 shows your progress in previous chapters on learning to use Spring to implement various fundamental capabilities in a system. As you observe, we made good progress, and you now can use Spring to implement capabilities in various parts of a system.