1.spring搜不到@requestmapping
导入包文件
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency>
2.这里是因为application和controller没有在一个包下,改下就好了
3.报错
Springboot启动时报错 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
在applicationt添加一句
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
4.拦截器不起作用,在Application上面添加一句
@SpringBootApplication(scanBasePackages={"com.example.demo"}) @ComponentScan(basePackages={"com.example.demo.config"})
5.找不到template的html的文件
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
右键项目 -》 找到Maven -》 选择Reimport即可,然后重启