这里并没有错误,但是IDEA报红
package com.example.demo.mapper;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest
@RunWith(SpringRunner.class)
public class UserMapperTest {
@Autowired
UserMapper userMapper;
public void insert() {
}
}
点击File>Settings>Inspections>Spring>Spring Core>Core>Autowiring for Bean Class>Severity:No highlighting,only fix
最后点击ok
解决