java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
越界错误,这里的错误指数组或列表长度为1 但是下标也到了1 所以导致错误。因此 Index size后面的值可能根据实际情况不同。新手常犯
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘XXXXX’. Cause: java.lang.ClassNotFoundException: Cannot find class:XXXXX
springboot项目中 mybatis的xml文件引发的错误,错误提示为找不到 EngyHandelSvg 类
原因:
是因为在编写mapper.xml文件时的 parameterType = “ XXXX” parameterType直接等于类名,导致在复杂的情况下,mybatis无法找到该类,因此需要给它加上全路径
解决方案如下:parameterType="com.central.system.vo.XXXX"
此处的xxxx为实际类名
Parameter 1 of constructor in com.central.system.service.impl.HandelSvgServiceImpl required a bean of type ‘java.lang.String’ that could not be found…
Parameter 1 of constructor in com.central.system.service.impl.HandelSvgServiceImpl required a bean of type 'java.lang.String' that could not be found.
Action:
Consider defining a bean of type 'java.lang.String' in your configuration.
此错误提示的大概意思是在com.central.system.service.impl.XXXX这个类的构造过程中参数1(也就是第二个参数)在bean注入时找不到,它的类型是String
看错误代码如下:
在这里插入图片描述
解决方案:
大多人常犯的错误为Mapper或service注入失败:
Description:
Parameter 0 of constructor in com.central.system.service.impl.DefineExcelServiceImpl required a bean of type 'com.central.system.mapper.DefineExcelMapper' that could not be found.
Action:
Consider defining a bean of type 'com.central.system.mapper.DefineExcelMapper' in your configuration.
检查 com.central.system.mapper.DefineExcelMapper 是否加了@mapper注解
@Mapper
public interface DefineExcelMapper
Spring Security报错
报错信息:
Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: permitAll only works with HttpSecurity.authorizeRequests()
重点语句:permitAll only works with HttpSecurity.authorizeRequests()
意思是说 permitAll仅适用于HttpSecurity.authorizeRequests()
查看配置代码中http后面的是不是写错了 错误示例如下http.authorizeHttpRequests() .antMatchers("/oauth/**","/login/**","/logout/**").permitAll() .anyRequest().authenticated() .and() //表单认证全部放行 .formLogin().permitAll();
解决方案:将authorizeHttpRequests()替换成authorizeRequests()