springboot + security + mybatis 权限模块

本文解决Spring Boot项目中访问静态资源失败及MySQL连接配置问题,包括配置WebSecurity以允许访问指定静态资源路径,更新mysql-connector-java依赖版本避免使用已废弃的驱动类,以及设置正确的时区属性解决连接异常。

参考:
https://blog.csdn.net/u012373815/article/details/54632176

博主写的几个拓展spring-boot的例子看起来不错,刚开始实践了第一个。
说说几个坑:

  1. 打开页面访问不到静态资源。
    ——在config/WebSecurityConfig.class文件中重写的configure方法中增加一行。.antMatchers(“/css/**”).permitAll()//added

  2. jdbc驱动报错:Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver’. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
    ——看了下pom.xml文件中,

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.5</version>
        </dependency>

这个版本的driver名称应该为:com.mysql.cj.jdbc.Driver 而不是 com.mysql.jdbc.Driver

  1. 报错:com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ‘?й????
    ——&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值