SpringBoot跨域请求处理方式
方法一、SpringBoot的注解@CrossOrigin(也支持SpringMVC)
简单粗暴的方式,Controller层在需要跨域的类或者方法上加上该注解即可
@RestController @CrossOrigin @RequestMapping("/situation") public class SituationController extends PublicUtilController { @Autowired private SituationService situationService; // log日志信息 private static Logger LOGGER = Logger.getLogger(SituationController.class); }
转自:https://blog.csdn.net/weixin_43841924/article/details/111614936