You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spring-boot-online-exam/backend/README.md

52 lines
1.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 在线考试系统的后端实现
## 拦截器注入application.yml中的属性
> 拦截器执行在自动bean初始化之前会导致拦截器中无法注入配置属性按照下面的步骤即可正常注入
+ 给拦截器加`@Component`注解
![拦截器注入配置文件属性](images/拦截器注入配置文件属性.png)
+ 在配置类中用`@Autowired`注入
![拦截器注入配置文件属性2](images/拦截器注入配置文件属性2.png)
## 代码调试的时候如何打印完整的SQL语句和参数
> 主要是指application.yml的配置
参考博客[JPA打印SQL参数](https://mp.weixin.qq.com/s/zyTOdTwFhi2CwxCI9P1kQw)
+ 打印SQL语句
```yaml
spring:
jpa:
# 调试的时候用用于打印完成SQL语句(但是不打印参数),联合下面的logging.level一同打印最完整的SQL信息(语句+参数)
show-sql: true
```
+ 不打印SQL语句
```yaml
spring:
jpa:
# 调试的时候用用于打印完成SQL语句(但是不打印参数),联合下面的logging.level一同打印最完整的SQL信息(语句+参数)
show-sql: false
```
+ 打印SQL参数
```yaml
# SQL语句打印(能打印参数设置为trace是打印完整语句默认我们就关掉吧)
logging:
level:
org.hibernate.type.descriptor.sql.BasicBinder: trace
```
+ 不打印SQL参数
```yaml
# SQL语句打印(能打印参数设置为trace是打印完整语句默认我们就关掉吧)
logging:
level:
org.hibernate.type.descriptor.sql.BasicBinder: off
```
## SpringBoot整合vue工程到static目录中遇到的问题
+ [Spring Boot整合Vue解决静态资源映射页面刷新失效路径配置等问题](https://blog.csdn.net/godelgnis/article/details/89683760)