-
新建一个基础项目
-
连接的数据库为postgres,配置文件如下
spring.datasource.url=jdbc:postgresql://localhost:5432
spring.datasource.username=postgres
spring.datasource.password=123456
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.hbm2ddl.auto=update -
添加对应的依赖
<postgresql.version>42.2.15</postgresql.version>
org.postgresql
postgresql
${postgresql.version}
-
bean实体类
-
controller类实现接受路径数据并调用service层返回一个类
-
service层完成数据的格式修改并调用dao层返回结果
-
dao层连接数据库并进行sql语句的运行,返回查询到的类数据
SpringBoot实现一个接口
最新推荐文章于 2024-05-16 00:00:42 发布