SpringBoot与数据访问
SpringBoot的数据处理JDBCMyBatisJPA(JavaPersistenceAPI)SpringDataJPA与SpringData整合JPA
SpringBoot的数据处理
在数据访问层,无论SQL还是NOSQL,SpringBoot默认采用整合SpringData的方式进行统一处理.添加大量自动配置,屏蔽很多设置.引入xxxTemplate,xxxRepository来简化我们对数据的访问操作JDBC
引入starterspring-boot-starter-jdbc
dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-jdbc/artifactId/dependencydependencygroupIdmysql/groupIdartifactIdmysql-connector-java/artifactIdscoperuntime/scope/dependency
配置application.yml
spring:datasource:username:rootpassword:url:jdbc:mysql://..32.:/jdbcdriver-class-name: