一、Mapper.xml文件加载问题
这个问题是只有idea编辑器存在的问题,mapper.xml文件我们习惯把它放在和其对应的接口的同一个包下,这在eclipse中是没有任何问题的,但是idea中会有问题,就是会Invalid bound statement (not found)
其实就是Mapper.xml文件没有被编译,那我们可以单独说一下这个,在我们运行SpringBoot的启动类的时候,我们的写的所有代码会被编译,会存储到target目录下。
从图中我们看出来,被编译后的文件中没有.xml文件,说明我们的.xml文件没有被编译,所以才会报错,这是我们需要改一个pom.xml配置,让idea去扫描我们的.xml文件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<!--解决idea中xml文件不被加载的问题-->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
二、静态文件
spring.mvc.static-path-pattern=/static/**
在springboot的属性文件加上这句话,spingboot会到static目录下去加载我们的静态资源
三、Controller层处理json格式的请求
使用@RequestBody:https://blog.csdn.net/justry_deng/article/details/80972817
/**
* 添加用户
*/
@ResponseBody
@RequestMapping("/insPeo")
public List<Peo> insPeo(@RequestBody Peo peo){
System.out.println(peo.toString());
this.peoService.insPeo(peo);
return this.peoService.selAll();
}
注意:它只能写在参数前面,不能写在函数前面
四、f7和vue混合的高度问题
给html标签添加height:atuo属性