参考:
https://blog.csdn.net/u012373815/article/details/54632176
博主写的几个拓展spring-boot的例子看起来不错,刚开始实践了第一个。
说说几个坑:
打开页面访问不到静态资源。
——在config/WebSecurityConfig.class文件中重写的configure方法中增加一行。.antMatchers(“/css/**”).permitAll()//addedjdbc驱动报错: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
- 报错:com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ‘?й????
——&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
本文解决Spring Boot项目中访问静态资源失败及MySQL连接配置问题,包括配置WebSecurity以允许访问指定静态资源路径,更新mysql-connector-java依赖版本避免使用已废弃的驱动类,以及设置正确的时区属性解决连接异常。

被折叠的 条评论
为什么被折叠?



