问题
SpringBoot工程突然莫名其妙报错:lateinit property mapper has not been initialized
最后发现是事务注解@Transactional导致的
由于kotlin方法访问权限默认为final, 而事务注解使用的是反射, 两者冲突
解决方案
第一种 去除事务注解(不推荐)
第二种 给报错的方法添加
open权限, 如下:1
2
3
4
5
6
7
8open fun userLogin(
userAccount: String,
userPassword: String,
request: HttpServletRequest?,
response: HttpServletResponse?
): String {
return ""
}
本文为作者原创转载时请注明出处 谢谢









