1、IDEA无法创建javaclass文件
解决办法:进入File--Project Structure--Project Settings--Modules中,你会发现右边有点类似与java的maven文件目录一样,点击src,并将它设置为Sources。
2、测试类自动注入失败:@RunWith(SpringRunner.class)详解
解决方法:(1)使用此注解需依赖:
(2)因为SpringRunner.class
继承了SpringJUnit4ClassRunner.class
且没有进行任何修改
所以@RunWith(SpringRunner.class)
基本等同于@RunWith(SpringJUnit4ClassRunner.class)
3、Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
at sun.reflect.GeneratedConstructorAccessor29.newInstance(Unknown Source) ~[na:na]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_181]
解决办法:连接url地址后面加上以下配置:
serverTimezone=UTC&allowMultiQueries=true&autoReconnect=true&useUnicode=true&failOverReadOnly=false&useSSL=false&characterEncoding=utf-8