如果你是小白,这套资料可以帮你成为大牛,如果你有丰富开发经验,这套资料可以帮你突破瓶颈
2022web全套视频教程前端架构 H5 vue node 小程序 视频+资料+代码+面试题.
java
import java.util.List;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CommonInterceptor2 implements WebMvcConfigurer {
@Override public void configurePathMatch(PathMatchConfigurer configurer) { // TODO Auto-generated method stub } @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { // TODO Auto-generated method stub } @Override public void configureAsyncSupport(AsyncSupportConfigurer configurer) { // TODO Auto-generated method stub } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { // TODO Auto-generated method stub } @Override public void addFormatters(FormatterRegistry registry) { // TODO Auto-generated method stub } @Override public void addInterceptors(InterceptorRegistry registry) { // TODO Auto-generated method stub } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // TODO Auto-generated method stub } @Override public void addCorsMappings(CorsRegistry registry) { // TODO Auto-generated method stub registry.addMapping("/**") .allowedHeaders("*") .allowedMethods("POST","GET","PUT", "DELETE") .allowedOrigins("*"); } @Override public void addViewControllers(ViewControllerRegistry registry) { // TODO Auto-generated method stub } @Override public void configureViewResolvers(ViewResolverRegistry registry) { // TODO Auto-generated method stub } @Override public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { // TODO Auto-generated method stub } @Override public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) { // TODO Auto-generated method stub } @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { // TODO Auto-generated method stub } @Override public void extendMessageConverters(List<HttpMessageConverter<?>> converters) { // TODO Auto-generated method stub } @Override public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { // TODO Auto-generated method stub } @Override public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { // TODO Auto-generated method stub } @Override public Validator getValidator() { // TODO Auto-generated method stub return null; } @Override public MessageCodesResolver getMessageCodesResolver() { // TODO Auto-generated method stub return null; }
tomcat
https://blog.csdn.net/weixin_44100514/article/details/109781103?spm=1001.2014.3001.5501
vue
proxy: { //配置跨域
‘/api’: {
target: ‘http://IP:端口/’, //这里后台的地址模拟的
changOrigin: true, //允许跨域
pathRewrite: {
/* 重写路径,当我们在浏览器中看到请求的地址为:http://localhost:8080/api/core/getData/userInfo 时
实际上访问的地址是:http://121.121.67.254:8185/core/getData/userInfo,因为重写了 /api
*/
‘^/api’: ‘’
}
},
}
nginx
location/ {
proxy_passhttp://localhost:8081/;
#proxy_set_headerHost $host:80; #proxy_set_headerX-Real-IP $remote_addr; #proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for; add_headerAccess-Control-Allow-Origin $http_origin; add_headerAccess-Control-Allow-Methods *; add_headerAccess-Control-Allow-Headers $http_access_control_request_headers; add_headerAccess-Control-Max-Age 60000; add_headerAccess-Control-Allow-Credentials true; if($request_method = OPTIONS){ return200; } }