新建一个基础项目
连接的数据库为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语句的运行,返回查询到的类数据



版权声明:本文为qq_45915570原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。