-
一开始只写了entity和mapper,进行测试的时候出现的bug
AopAutoConfiguration matched:
@ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)
翻译:AOP自动配置匹配:……
这属于aop配置的问题,解决方法:
需要在主类中扫包,即添加
@MapperScan
注解,把本项目对应的 mapper包扫描一下,主类代码如下所示(添加的那一行,就是@MapperScan("com.example.layuitest.mapper")
):package com.example.layuitest; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @MapperScan("com.example.layuitest.mapper") //添加这一行 public class LayuiTestApplication { public static void main(String[] args) { SpringApplication.run(LayuiTestApplication.class, args); } }
-
mysql列名里面的下划线,在项目entity中封装时,需要转化为驼峰
例如:a_fa 转化为 aFa
-
空指针异常
java.lang.NullPointerException
在这一部分中,大多数的数据已经查出来了,只是有一个数据,因为数据表之间对应不上(例如某商品的货号为1,但是在货号表中,没有货号1这个分类),所以查不到。因此查询代码是没有问题的。
解决方法:先判断该数据是否为空,如果不为空,我们再进行查询。
QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("id",product.getCategoryleveloneId()); ProductCategory productCategory = productCategoryMapper.selectOne(wrapper); //判断是否为空,如果不为空,我们再进行查询 if(productCategory!=null){ productVO.setCategorylevelone(productCategory.getName()); }
-
注解错误:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
-
Error resolving template [favicon.ico], template might not exist or might not be accessible by any of the configured Template Resolvers
这属于:解析模板时出错
spring boot+layui+mysql+mybatis-plus 项目建立过程中的bug
最新推荐文章于 2024-10-04 22:00:00 发布