spring frame(5)

Spring+jdbc combination


Configure data sources, transactions. There are two basic ways to configure transactions: annotation-based and xml configuration. The data source defaults to singleton mode when it is configured .

Configure the data source


 
Or configure the properties file


 
Spring files can use placeholders directly

 Annotation transaction

 
detailed xml configuration


 
get data source

Create a class that implements the business interface and inject the data source. Then hand over this class to spring for management.


 Manipulate jdbcTemplate

Write a query to receive a class personRowMapper


 The class is annotated with @Transactional

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326982700&siteId=291194637