没有导入相应的类包,建议设置idea自动导入类包:打开设置搜索Auto Import将Add unambiguous imports on the fly前边的方框打上勾即可
你需要import , 可以使用idea快捷键 自动引入 ALT + enter