最后
金三银四马上就到了,希望大家能好好学习一下这些技术点
学习视频:
大厂面试真题:
// 最原始的方式,手动写请求头
response.setHeader(“Access-Control-Allow-Origin”, “http://192.168.163.1:8081”);
return callback + “(‘hello’)”;
}
// 将跨域设置在方法上
@RequestMapping(“/cors”)
@CrossOrigin(origins = {“http://localhost:8080”, “http://remotehost:82323”},
methods = {RequestMethod.GET, RequestMethod.POST},
allowedHeaders = {“Content-Type”, “skfjksdjfk”},
allowCredentials = “true”,
maxAge = 1898978
)
@RequestMapping(“/rrr”)
public String rrr(@RequestParam(defaultValue = “callback”) String callback) {
return callback + “(‘rrr’)”;
}
}
不使用注解模式:
package com.nf147.manage.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
@RestController
public class CorsConstroller {
@RequestMapping(“/cors”)
public String cors (@RequestParam(defaultValue = “callback”) String callback, HttpServletResponse response) {
//使用Access-Control-Allow-Origin解决跨请求
response.setHeader(“Access-Control-Allow-Origin”, “http://169.—236.45:8080”); 注意这里要和本地服务器的url一致
return callback + “(‘hello’)”;
}
}
请求页面:
发送
最后
做任何事情都要用心,要非常关注细节。看起来不起眼的、繁琐的工作做透了会有意想不到的价值。
当然要想成为一个技术大牛也需要一定的思想格局,思想决定未来你要往哪个方向去走, 建议多看一些人生规划方面的书籍,多学习名人的思想格局,未来你的路会走的更远。
更多的技术点思维导图我已经做了一个整理,涵盖了当下互联网最流行99%的技术点,在这里我将这份导图分享出来,以及为金九银十准备的一整套面试体系,上到集合,下到分布式微服务
-1715572565059)]
[外链图片转存中…(img-V0qggFIO-1715572565060)]