网上看了很多例子,五花八门,我是这样解决的,配置application.yml,把红色那行代码注释掉,成功,没有出现问题
spring:
datasource:
# 数据源的基本配置
username: sa
password: 1234
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://localhost:1433;Databasename=vote
type: com.alibaba.druid.pool.DruidDataSource
# 数据源的其他配置
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 120000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
# filters: stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize: 20
useGlobalDataSourceStat: true
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
# CMS脚本.sql中一般存放的是DDL脚本
schema: classpath:CMS脚本.sql
servlet:
multipart:
# 单个文件的最大值
max-file-size: 10MB
# 上传文件总的最大值
max-request-size: 1000MB
mail:
# 邮件服务地址
host: smtp.163.com
# 端口,可不写默认
port: 25
# 编码格式
default-encoding: utf-8
# 用户名
username: xxx@163.com
# 授权码,就是我们刚才准备工作获取的代码
password: xxx
# 其它参数
properties:
mail:
smtp:
# 如果是用 SSL 方式,需要配置如下属性,使用qq邮箱的话需要开启
ssl:
enable: true
required: true
# 邮件接收时间的限制,单位毫秒
timeout: 10000
# 连接时间的限制,单位毫秒
connectiontimeout: 10000
# 邮件发送时间的限制,单位毫秒
writetimeout: 10000
#server:
# port: 80
# servlet:
# 设置项目访问路径
# context-path: /manager
#上传文件保存的相对路径
relativePath: /static/image/
#静态资源对外暴露的访问路径
staticAccessPath: /static/image/**
#上传文件保存文件夹
uploadPath: D://vote/images/
# 设置开发环境
# profiles:
# active: dev
mybatis-plus:
# 如果是放在src/main/java目录下 classpath:/com/yourpackage/*/mapper/*Mapper.xml
# 如果是放在resource目录 classpath:/mapper/*Mapper.xml
mapper-locations: classpath:mybatis/mappers/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.atguigu.springboot.entities
global-config:
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
id-type: 0
#字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
field-strategy: 1
#驼峰下划线转换
#db-column-underline: true
#刷新mapper 调试神器
#refresh-mapper: true
#数据库大写下划线转换
#capital-mode: true
# Sequence序列接口实现类配置
#key-generator: com.baomidou.mybatisplus.incrementer.OracleKeyGenerator
#逻辑删除配置(下面3个配置)-->根据设置标志来实现逻辑删除
logic-delete-value: -1
logic-not-delete-value: 1
sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
#自定义填充策略接口实现
meta-object-handler: com.atguigu.springboot.util.MyMetaObjectHandler
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
#配置JdbcTypeForNull
jdbc-type-for-null: 'null'
#打印sql语句以及查询结果打印到控制台
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
# 配置springboot默认日志级别
level:
root: INFO
# 指定日志文件
# 在不指定路径时默认在当前项目下生成springboot.log文件
# 指定路径时在指定的路径下生成对info应的文件
# file: springboot.log
#file: D:/springboot
# 在当前项目所在磁盘的根目录下创建spring和log两个目录,并且生成spring.log文件
# 与loggging.file同时存在时,logging.file生效
#path: E:/springboot/log
pattern:
# 设置控制台日志格式
# console: '%d{yyyy-MM-dd} [%thread] %-5level %logger{50} - %msg%n'
# 设置日志文件日志输出格式
file: '%d{yyyy-MM-dd} === [%thread] === %-5level === %logger{50} ===%msg%n'
# 设置自定义日志配置文件
config: classpath:logback-spring.xml
server:
port: 8885
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)