问题遇到的现象和发生背景
在进行java spring boot入门,IDEA里自动创建之后照着教程加了一下的代码,然后就出现了Cannot resolve symbol 'web',运行后报错org.springframework.web.bind.annotation,这该怎么解决啊?
问题相关代码,请勿粘贴截图
package com.example.magicdemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
@Controller
@SpringBootApplication
public class MagicdemoApplication {
@RequestMapping("/")
@ResponseBody
String home() {
return "magic explosion!";
}
public static void main(String[] args) {
SpringApplication.run(MagicdemoApplication.class, args);
}
}