yml文件结尾时,写出的配置应该如下,区分sever、spring、mybatis
代码:
server:
port: 8080
spring:
datasource:
name: test
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: root
password: root
type: com.alibaba.druid.pool.DruidDataSource
mybatis:
mapper-locations: classpath*:com/example/demo/mapper/*.java
configuration:
mapUnderscoreToCamelCase: true
如果时以.properties结尾的配置文件应该如下:
代码:
#配置端口
server.port=8080
#外网地址
spring.datasource.url=jdbc:mysql://localhost/nn?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=