Java 类org.springframework.web.servlet.config.annotation.WebMvcConfigurer 实例源码

项目:happylifeplat-transaction    文件:AdminConfiguration.java   
@Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurerAdapter() {
         /*   @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/login*//*").allowedOrigins("*");
                registry.addMapping("/recover*//*").allowedOrigins("*");
                registry.addMapping("/tx*//*").allowedOrigins("*");

            }
*/
            @Override
            public void addInterceptors(InterceptorRegistry registry) {
                registry.addInterceptor(new AuthInterceptor()).addPathPatterns("/**");
            }
        };
    }
项目:basic    文件:Application.java   
@Bean
public WebMvcConfigurer webMvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addViewControllers(ViewControllerRegistry viewControllerRegistry) {

            // 首页默认加载web端
            viewControllerRegistry.addViewController("/").setViewName("/web/index.html");
            viewControllerRegistry.addViewController("/index.html").setViewName("redirect:/");

            // web首页
            viewControllerRegistry.addViewController("/web").setViewName("/web/index.html");

            // webapp首页
            viewControllerRegistry.addViewController("/webapp").setViewName("/webapp/index.html");

            viewControllerRegistry.setOrder(Ordered.HIGHEST_PRECEDENCE);
            super.addViewControllers(viewControllerRegistry);
        }
    };
}
项目:syndesis    文件:Application.java   
@Bean
public WebMvcConfigurer staticResourceConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
            registry
                .addResourceHandler("/mapper/**")
                .addResourceLocations(
                    "classpath:/META-INF/syndesis/mapper/",
                    "classpath:/META-INF/resources/mapper/",
                    "classpath:/static/mapper/",
                    "classpath:/resources/mapper/"
                );
        }
    };
}
项目:hsweb-framework    文件:HswebAutoConfiguration.java   
@Bean
public WebMvcConfigurer webMvcConfigurer(List<HandlerMethodArgumentResolver> handlerMethodArgumentResolvers) {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
            super.addArgumentResolvers(argumentResolvers);
            argumentResolvers.addAll(handlerMethodArgumentResolvers);
        }

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new HandlerInterceptorAdapter() {
                @Override
                public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
                    //clear thread local
                    ThreadLocalUtils.clear();
                }
            });
        }
    };
}
项目:wonderjameeee    文件:SecurityConfiguration.java   
@Bean
WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/")
                    .allowedOrigins("*")
                    .allowedMethods("POST, GET, OPTIONS, DELETE ,PUT")
                    .allowedHeaders(AUTHORIZATION_HEADER, CONTENT_TYPE_HEADER, X_REQUESTED_WITH_HEADER, ACCEPT_HEADER, ORIGIN_HEADER,
                            AC_REQUEST_METHOD_HEADER, AC_REQUEST_HEADERS_HEADER, AC_ALLOW_ORIGIN_HEADER, AC_ALLOW_CREDENTIALS_HEADER, XXSRFTOKEN, XXSRFTOKEN2)
                    .exposedHeaders(AUTHORIZATION_HEADER, CONTENT_TYPE_HEADER, X_REQUESTED_WITH_HEADER, ACCEPT_HEADER, ORIGIN_HEADER,
                            AC_REQUEST_METHOD_HEADER, AC_REQUEST_HEADERS_HEADER, AC_ALLOW_ORIGIN_HEADER, XXSRFTOKEN, XXSRFTOKEN2)
                    .allowCredentials(true).maxAge(3600);
        }
    };
}
项目:appverse-server    文件:FrontFacadeRestAutoConfiguration.java   
/**
 * Spring4 Cors filter
 *  By default disabled
 * @return
 */
@Bean
@ConditionalOnProperty(value="appverse.frontfacade.rest.cors.enabled", matchIfMissing=false)
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            String path = apiPath;
            if (!StringUtils.isEmpty(corsPath)){
                path = corsPath;
            }
            registry.addMapping(path + "/**")
                    .allowedOrigins(StringUtils.commaDelimitedListToStringArray(allowedOrigins))
                    .allowedMethods(StringUtils.commaDelimitedListToStringArray(allowedMethods))
                    .allowedHeaders(StringUtils.commaDelimitedListToStringArray(allowedHeaders))
                    .allowCredentials(Boolean.valueOf(allowedCredentials))
                    .maxAge(Long.valueOf(maxAge));
        }
    };
}
项目:yona-server    文件:AppServiceApplication.java   
@Bean
public WebMvcConfigurer corsConfigurer()
{
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry)
        {
            registry.addMapping("/swagger/swagger-spec.yaml");
            if (yonaProperties.getSecurity().isCorsAllowed())
            {
                // Enable CORS for the other resources, to allow testing the API through Swagger UI.
                registry.addMapping("/**").allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE");
            }
        }
    };
}
项目:data-prep    文件:CORSConfiguration.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {

        @Override
        public void addCorsMappings(CorsRegistry registry) {
            // Add CORS header for all path in application
            registry.addMapping("/**") //
                    .allowedOrigins("*") //
                    .allowedMethods("POST", "GET", "OPTIONS", "DELETE", "PUT", "PATCH") //
                    .maxAge(3600) //
                    .allowedHeaders("x-requested-with", "Content-Type", "accept", "Authorization")
                    .exposedHeaders("Authorization")
                    .allowCredentials(true);
        }
    };
}
项目:SpaceInvasion-09-2017    文件:SpaceInvasion.java   
@Bean
@SuppressWarnings("AnonymousInnerClassMayBeStatic")
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/v1/**")
                    .allowCredentials(true)
                    .allowedOrigins(Constants.UrlConstants.ALLOWED_ORIGINS)
                    .allowedMethods("GET", "HEAD", "POST", "PATCH", "DELETE", "OPTIONS");
        }
    };
}
项目:112016.pizzeria-app    文件:PizzeriaApp.java   
/**
 * Activation de CORS pour tous les domaines.
 * 
 * @return Configurateur Spring MVC.
 */
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {

            registry.addMapping("/**").allowedOrigins("*");

        }
    };
}
项目:digag-server    文件:WebSecurityConfig.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("*")
                    .allowedMethods("GET", "HEAD", "POST","PUT", "DELETE", "OPTIONS")
                    .allowCredentials(false).maxAge(3600);
        }
    };
}
项目:googlecloud-techtalk    文件:CorsConfig.java   
@Bean
public WebMvcConfigurer mvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedMethods("GET", "PUT", "POST", "GET", "OPTIONS");
        }
    };
}
项目:istio-ola    文件:KeycloakCORSConfiguration.java   
@Bean
public WebMvcConfigurer corsConfiguration() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/api/**")
                    .allowedMethods(HttpMethod.GET.toString(), HttpMethod.POST.toString(),
                            HttpMethod.PUT.toString(), HttpMethod.DELETE.toString(), HttpMethod.OPTIONS.toString())
                    .allowedOrigins("*");
        }
    };
}
项目:taskana    文件:WebSecurityConfig.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("*");
        }
    };
}
项目:debattons    文件:ApiServerApplication.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
  return new WebMvcConfigurerAdapter() {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
      registry.addMapping("/**").allowedOrigins("http://localhost:4200");
    }
  };
}
项目:happylifeplat-tcc    文件:AdminConfiguration.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new AuthInterceptor()).addPathPatterns("/**");
        }
    };
}
项目:jwtExample    文件:Application.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {

            registry.addMapping("/**").allowedOrigins("http://localhost:4200");
            registry.addMapping("/**").allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "OPTIONS",
                    "PATCH");

        }
    };
}
项目:remember-me-back    文件:CorsConfiguration.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedMethods("GET", "POST", "PUT", "DELETE");
        }
    };
}
项目:docker-dash    文件:DockerDashApp.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            // TODO check if its working
            registry.addMapping("/**").allowedOrigins("*");
        }
    };
}
项目:myth    文件:AdminConfiguration.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new AuthInterceptor()).addPathPatterns("/**");
        }
    };
}
项目:AppleSeed    文件:CorsConfig.java   
@Bean
public WebMvcConfigurer mvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedMethods("GET", "PUT", "POST", "GET", "OPTIONS");
        }
    };
}
项目:spring-boot-vue-simple-sample    文件:DemoApplication.java   
@Bean
@Conditional(Development.class)
public WebMvcConfigurer webMvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(final CorsRegistry registry) {
            registry.addMapping("/**");
        }
    };
}
项目:RFTBackend    文件:Application.java   
@Bean
public WebMvcConfigurer mvcConfig() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("*").allowedMethods("PUT","DELETE","GET","POST");
        }
    };
}
项目:exampp    文件:WebConfig.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedOrigins("http://localhost:4200", "http://localhost:8080")
                    .allowedMethods("GET", "PUT", "POST", "DELETE");
        }
    };
}
项目:microservices-sample-project    文件:AsyncConfig.java   
@Bean
public WebMvcConfigurer rxJavaWebMvcConfiguration(List<AsyncHandlerMethodReturnValueHandler> handlers) {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
            if (handlers != null) {
                returnValueHandlers.addAll(handlers);
            }
        }
    };
}
项目:microservices-sample-project    文件:AppConfiguration.java   
/**
 * allow all origins - only for development mode
 * @return
 */
@Bean
   public WebMvcConfigurer corsConfigurer() {
       return new WebMvcConfigurerAdapter() {
           @Override
           public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
            .allowedMethods("*");
           }
       };
}
项目:microservices-sample-project    文件:AppConfiguration.java   
/**
 * allow all origins - only for development mode
 * @return
 */
@Bean
   public WebMvcConfigurer corsConfigurer() {
       return new WebMvcConfigurerAdapter() {
           @Override
           public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
            .allowedMethods("*");
           }
       };
}
项目:ingest-core    文件:CorsConfig.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE").allowedOrigins("*")
                    .allowedHeaders("*");
        }
    };
}
项目:tulingchat    文件:CORSConfig.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            // 配置CorsInterceptor的CORS参数
            registry.addMapping("/**").allowedOrigins("*").allowCredentials(true).allowedHeaders("*")
                    .allowedMethods("*").maxAge(3600);
        }
    };
}
项目:pokemon    文件:AsyncConfig.java   
@Bean
public WebMvcConfigurer rxJavaWebMvcConfiguration(List<AsyncHandlerMethodReturnValueHandler> handlers) {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
            if (handlers != null) {
                returnValueHandlers.addAll(handlers);
            }
        }
    };
}
项目:pokemon    文件:AppConfiguration.java   
/**
 * allow all origins - only for development mode
 * @return
 */
@Bean
   public WebMvcConfigurer corsConfigurer() {
       return new WebMvcConfigurerAdapter() {
           @Override
           public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
            .allowedMethods("*");
           }
       };
}
项目:pokemon    文件:AppConfiguration.java   
/**
 * allow all origins - only for development mode
 * @return
 */
@Bean
   public WebMvcConfigurer corsConfigurer() {
       return new WebMvcConfigurerAdapter() {
           @Override
           public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
            .allowedMethods("*");
           }
       };
}
项目:chvote-protocol-poc    文件:WebSecurityConfigurer.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedMethods("GET", "POST", "OPTIONS")
                    .allowedOrigins("*");
        }
    };
}
项目:d2g-api    文件:Application.java   
@Bean
public WebMvcConfigurer D2GApiCorsConfig(){
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").
                    allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD");
                   // .allowedOrigins("http://localhost:8080"); TODO : Allowed servers
        }
    };
}
项目:Plum    文件:CorsConfig.java   
@Bean
public WebMvcConfigurer mvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("*//**").allowedMethods("GET", "PUT", "POST", "GET", "OPTIONS");
        }
    };
}
项目:async-engine    文件:Application.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("http://localhost:4200");
        }
    };
}
项目:queue-ticket-api    文件:WebConfig.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedMethods("*");
        }
    };
}
项目:chat-rooms    文件:WebSecurityConfig.java   
@Bean
public WebMvcConfigurer corsConfigurer() {

    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
                    .allowedOrigins("*");
        }
    };
}
项目:hsweb-framework    文件:AuthorizingHandlerAutoConfiguration.java   
@Bean
public WebMvcConfigurer webUserTokenInterceptorConfigurer(UserTokenManager userTokenManager,
                                                          List<UserTokenParser> userTokenParser) {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new WebUserTokenInterceptor(userTokenManager, userTokenParser));
            super.addInterceptors(registry);
        }
    };
}
项目:romanescU-spring-api    文件:Application.java   
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("*");
        }
    };
}