@Configuration @EnableTransactionManagement(proxyTargetClass=true) @EnableAspectJAutoProxy(proxyTargetClass=true,exposeProxy=true) public class DataSourceConfigure{ seata?new io.seata.rm.datasource.DataSourceProxy(dataSource); } @EnableAsync @Configuration @EnableWebMvc public class ServletConfigure implements WebMvcConfigurer,ApplicationContextAware{ @Bean public ErrorPageRegistrar errorPageRegistrar(){ return new ErrorPageRegistrar(){ public void registerErrorPages(ErrorPageRegistry registry){ ErrorPage error400page = new ErrorPage(HttpStatus.BAD_REQUEST,"error/400"); ErrorPage error401page = new ErrorPage(HttpStatus.UNAUTHORIZED,"error/401");////HttpStatus.NOT_FOUND ErrorPage error500page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"error/500");//HttpStatus.UNSUPPORTED_MEDIA_TYPE registry.addErrorPages(new ErrorPage[]{error400page,error401page,error500page,new ErrorPage(Throwable.class,"/error/500")}) } } }
}
public void addInterceptors(InterceptorRegistry registry){
registry.addInterceptor(new OAuthIntercepter);//OAuthInterceptor extends HandlerInterceptorAdapter
Map<String,HandlerInterceptor> itcps = this.applicationContext.getBeanOfType(HandlerIntercepter.class);
}
@Value("${rck.mq.consumer.group-name:${spring.application.name}}")
@ConditionalOnProperty(name={"on"},havingValue="true",matchIfMissing=true)
@ConditionalOnExpression("'${message.queue.side}'!='consumer'")
@ConditionalOnWebApplication
@EnableAsync
@Configurable
@Qualifier("beanName")
@EnableScheduling
public class ScheduleConfigure implements SchedulingConfigurer,AsyncConfigurer{
private ThreadPoolTaskScheduler ;
}
@EnableRetry
@Retryable(value=Exception.class,maxAttempts=2,backoff=@Backoff(delay=1500))
public class uucSsoConfiguration{
@Bean
public FilterRegistrationBean<UucLoginFilter> registerUucLoginFilter(){
FilterRegistrationBean<UucLoginFilter> filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(uucLoginFilter);//uucLoginFilter extends java.servlet.Filter
filterRegistrationBean.setUrlPatterns(List<String>); filterRegistrationBean.setOrder(1);
return filterRegistrationBean;
}
}
标签:spring,HttpStatus,class,ErrorPage,注解,new,public,filterRegistrationBean From: https://www.cnblogs.com/sxsheng/p/16898125.html