spring boot异常积累
1、异常:Error resolving template "xxx", template might not exist or might not be accessible...解决办法
解决办法:在报出这个异常的方法上添加注解@ResponseBody
加上 @ResponseBody 后,会直接返回 json 数据
2、Field xxMapper in XXXXXX requried a bean of type ‘XXXMapper’ that could not be found ...解决办法
@Component public interface XXXDepMapper{ @InsertProvider(...) int insertXXX(....); }
解决办法:springboot和mybatis整合中,组件需要在配置中设置@MapperScan扫描包
@Confuguration @EnableTransactionManagement @MapperScab(vasePackages={"xxxxx.mapper"},sqlSessionFactoryRef="") public class PostgressConfiguraction{ .... }
3、server.servlet-path:应用上下文路径,项目路径是构成url地址的一部分
springboot版本更新后从server.context-path改成了server.servlet-path