Skip to content

将src/main/resources/application.properties改名为application.yml

内容如下:

spring: datasource: url: jdbc:mysql://localhost:3306/constructional_engineering?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&autoReconnect=true&useSSL=false&allowMultiQueries=true username: root password: Hr123456 driver-class-name: com.mysql.cj.jdbc.Driver mybatis: mapper-locations: classpath:mapper/*Mapper.xml type-aliases-package: com.test.elasticsearchdemo.domain constructional_engineering ==为数据库名称;==

运行,这时访问localhost:8080,显示spring boot 默认404页

  • controller展示 定义接口路径和调用service
  • service 处理业务逻辑 数据库数据
  • mapper定义操作数据库动作,命名
  • mapper.xml执行mapper里定义的动作的sql语句,与数据库交互
  • entity 定义类,与数据库类型保持一致

本站总访问 — 次