共计 528 个字符,预计需要花费 2 分钟才能阅读完成。
spring boot 我的项目根底入门
实现 Goods 我的项目的增删改查
1)创立 spring starter boot 我的项目
2) 增加依赖:jdbc,mysql,spring,mybatis,thymeleaf
3)批改我的项目的 application.properties 文件
配置端口号(能够在浏览器拜访时不写端口号)server.port=80(80 端口号在拜访时能够省略) | |
配置 spring boot 与数据库的连贯 | |
spring.datasource.url | |
spring.datasource.username | |
spring.datasource.password | |
配置 mybatis.mapper-location=classpath:/templates/pages/ | |
配置 classpath:/mapper/*/*.xml | |
配置.html |
4)创立 pojo 对象
5) 创立数据层接口
用 @Mapper 形容该接口 | |
这里写映射(既增删改查的 SQL 语句及办法) |
6)创立业务层接口
这里写业务办法
7)创立业务层的实现类
用 @Service 形容该类 | |
这里重写业务层接口的所有形象办法 |
8)创立 Controller 类
这里调用业务层实现类的办法做增删改查
9)创立 html, 获取相应的数据及在页面上显示
正文完
发表至: springboot
2020-09-01