org.springframework.core.Ordered Java Examples

The following examples show how to use org.springframework.core.Ordered. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JacksonConfig.java    From mall with MIT License 6 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public Jackson2ObjectMapperBuilderCustomizer customJackson() {
    return new Jackson2ObjectMapperBuilderCustomizer() {
        @Override
        public void customize(Jackson2ObjectMapperBuilder builder) {
            builder.serializerByType(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            builder.serializerByType(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
            builder.serializerByType(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));

            builder.deserializerByType(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            builder.deserializerByType(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
            builder.deserializerByType(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
            builder.serializationInclusion(JsonInclude.Include.NON_NULL);
            builder.failOnUnknownProperties(false);
            builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
        }
    };
}
 
Example #2
Source File: WebSocketMessagingHandlerConfiguration.java    From jetlinks-community with Apache License 2.0 6 votes vote down vote up
@Bean
public HandlerMapping webSocketMessagingHandlerMapping(MessagingManager messagingManager,
                                       UserTokenManager userTokenManager,
                                       ReactiveAuthenticationManager authenticationManager) {


    WebSocketMessagingHandler messagingHandler=new WebSocketMessagingHandler(
        messagingManager,
        userTokenManager,
        authenticationManager
    );
    final Map<String, WebSocketHandler> map = new HashMap<>(1);
    map.put("/messaging/**", messagingHandler);

    final SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
    mapping.setOrder(Ordered.HIGHEST_PRECEDENCE);
    mapping.setUrlMap(map);
    return mapping;
}
 
Example #3
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testViewResolutionWithContentNegotiation() throws Exception {
	loadBeanDefinitions("mvc-config-view-resolution-content-negotiation.xml");

	ViewResolverComposite compositeResolver = this.appContext.getBean(ViewResolverComposite.class);
	assertNotNull(compositeResolver);
	assertEquals(1, compositeResolver.getViewResolvers().size());
	assertEquals(Ordered.HIGHEST_PRECEDENCE, compositeResolver.getOrder());

	List<ViewResolver> resolvers = compositeResolver.getViewResolvers();
	assertEquals(ContentNegotiatingViewResolver.class, resolvers.get(0).getClass());
	ContentNegotiatingViewResolver cnvr = (ContentNegotiatingViewResolver) resolvers.get(0);
	assertEquals(6, cnvr.getViewResolvers().size());
	assertEquals(1, cnvr.getDefaultViews().size());
	assertTrue(cnvr.isUseNotAcceptableStatusCode());

	String beanName = "contentNegotiationManager";
	DirectFieldAccessor accessor = new DirectFieldAccessor(cnvr);
	ContentNegotiationManager manager = (ContentNegotiationManager) accessor.getPropertyValue(beanName);
	assertNotNull(manager);
	assertSame(manager, this.appContext.getBean(ContentNegotiationManager.class));
	assertSame(manager, this.appContext.getBean("mvcContentNegotiationManager"));
}
 
Example #4
Source File: CacheConfigurationCustomizerEnabledAppendTest.java    From camel-spring-boot with Apache License 2.0 6 votes vote down vote up
@Order(Ordered.HIGHEST_PRECEDENCE)
@Bean
public ComponentCustomizer<EhcacheComponent> customizer() {
    return new ComponentCustomizer<EhcacheComponent>() {
        @Override
        public void customize(EhcacheComponent component) {
            component.addCachesConfigurations(Collections.singletonMap(
                CACHE_CONFIG_ID,
                CacheConfigurationBuilder.newCacheConfigurationBuilder(
                    String.class,
                    String.class,
                    ResourcePoolsBuilder.newResourcePoolsBuilder()
                        .heap(2100, EntryUnit.ENTRIES)
                        .offheap(2, MemoryUnit.MB))
                    .build()
            ));
        }
    };
}
 
Example #5
Source File: JacksonConfig.java    From BigDataPlatform with GNU General Public License v3.0 6 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public Jackson2ObjectMapperBuilderCustomizer customJackson() {
    return new Jackson2ObjectMapperBuilderCustomizer() {
        @Override
        public void customize(Jackson2ObjectMapperBuilder builder) {
            builder.serializerByType(LocalDateTime.class,
                    new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            builder.serializerByType(LocalDate.class,
                    new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
            builder.serializerByType(LocalTime.class,
                    new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
            builder.deserializerByType(LocalDateTime.class,
                    new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            builder.deserializerByType(LocalDate.class,
                    new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
            builder.deserializerByType(LocalTime.class,
                    new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
            builder.serializationInclusion(JsonInclude.Include.NON_NULL);
            builder.failOnUnknownProperties(false);
            builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
        }
    };
}
 
Example #6
Source File: DispatcherHandlerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void handlerMappingOrder() {
	HandlerMapping hm1 = mock(HandlerMapping.class, withSettings().extraInterfaces(Ordered.class));
	HandlerMapping hm2 = mock(HandlerMapping.class, withSettings().extraInterfaces(Ordered.class));
	when(((Ordered) hm1).getOrder()).thenReturn(1);
	when(((Ordered) hm2).getOrder()).thenReturn(2);
	when((hm1).getHandler(any())).thenReturn(Mono.just((Supplier<String>) () -> "1"));
	when((hm2).getHandler(any())).thenReturn(Mono.just((Supplier<String>) () -> "2"));

	StaticApplicationContext context = new StaticApplicationContext();
	context.registerBean("b2", HandlerMapping.class, () -> hm2);
	context.registerBean("b1", HandlerMapping.class, () -> hm1);
	context.registerBean(HandlerAdapter.class, SupplierHandlerAdapter::new);
	context.registerBean(HandlerResultHandler.class, StringHandlerResultHandler::new);
	context.refresh();

	DispatcherHandler dispatcherHandler = new DispatcherHandler(context);

	MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
	dispatcherHandler.handle(exchange).block(Duration.ofSeconds(0));
	assertEquals("1", exchange.getResponse().getBodyAsString().block(Duration.ofSeconds(5)));
}
 
Example #7
Source File: AopConfigUtils.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Nullable
private static BeanDefinition registerOrEscalateApcAsRequired(
		Class<?> cls, BeanDefinitionRegistry registry, @Nullable Object source) {

	Assert.notNull(registry, "BeanDefinitionRegistry must not be null");

	if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) {
		BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
		if (!cls.getName().equals(apcDefinition.getBeanClassName())) {
			int currentPriority = findPriorityForClass(apcDefinition.getBeanClassName());
			int requiredPriority = findPriorityForClass(cls);
			if (currentPriority < requiredPriority) {
				apcDefinition.setBeanClassName(cls.getName());
			}
		}
		return null;
	}

	RootBeanDefinition beanDefinition = new RootBeanDefinition(cls);
	beanDefinition.setSource(source);
	beanDefinition.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
	beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	registry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);
	return beanDefinition;
}
 
Example #8
Source File: BeanAggregateAutoConfiguration.java    From spring-boot-data-aggregator with Apache License 2.0 6 votes vote down vote up
@Bean(name = "aggregateQueryInterceptorChain")
@ConditionalOnMissingBean(AggregateQueryInterceptorChain.class)
public AggregateQueryInterceptorChain aggregateQueryInterceptorChain() {
    Map<String, AggregateQueryInterceptor> interceptorMap = applicationContext.getBeansOfType(AggregateQueryInterceptor.class);
    AggregateQueryInterceptorChainImpl interceptorChain = new AggregateQueryInterceptorChainImpl();
    if(interceptorMap != null  && ! interceptorMap.isEmpty()) {
        List<AggregateQueryInterceptor> interceptors = new ArrayList<>(interceptorMap.values());
        interceptors.sort(new Comparator<AggregateQueryInterceptor>() {
            @Override
            public int compare(AggregateQueryInterceptor o1, AggregateQueryInterceptor o2) {
                Order order1 = o1.getClass().getAnnotation(Order.class);
                Order order2 = o2.getClass().getAnnotation(Order.class);
                int oi1 = order1 == null ? Ordered.LOWEST_PRECEDENCE :  order1.value();
                int oi2 = order2 == null ?  Ordered.LOWEST_PRECEDENCE : order2.value();
                return oi1 - oi2;
            }
        });
        for (AggregateQueryInterceptor interceptor : interceptors) {
            interceptorChain.addInterceptor(interceptor);
        }
    }
    return interceptorChain;
}
 
Example #9
Source File: GatewayConfiguration.java    From open-cloud with MIT License 6 votes vote down vote up
/**
 * 跨域配置
 *
 * @return
 */
@Bean
public FilterRegistrationBean corsFilter() {
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowCredentials(true);
    config.setAllowedHeaders(Lists.newArrayList(ALLOWED_HEADERS.split(",")));
    config.setAllowedOrigins(Lists.newArrayList(ALLOWED_ORIGIN.split(",")));
    config.setAllowedMethods(Lists.newArrayList(ALLOWED_METHODS.split(",")));
    config.setMaxAge(MAX_AGE);
    config.addExposedHeader(ALLOWED_EXPOSE);

    source.registerCorsConfiguration("/**", config);
    FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    //最大优先级,设置0不好使
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
    log.info("CorsFilter [{}]", bean);
    return bean;
}
 
Example #10
Source File: JacksonConfig.java    From dts-shop with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public Jackson2ObjectMapperBuilderCustomizer customJackson() {
	return new Jackson2ObjectMapperBuilderCustomizer() {
		@Override
		public void customize(Jackson2ObjectMapperBuilder builder) {
			builder.serializerByType(LocalDateTime.class,
					new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
			builder.serializerByType(LocalDate.class,
					new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
			builder.serializerByType(LocalTime.class,
					new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));

			builder.deserializerByType(LocalDateTime.class,
					new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
			builder.deserializerByType(LocalDate.class,
					new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
			builder.deserializerByType(LocalTime.class,
					new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
			builder.serializationInclusion(JsonInclude.Include.NON_NULL);
			builder.failOnUnknownProperties(false);
			builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
		}
	};
}
 
Example #11
Source File: FaradayConfiguration.java    From staffjoy with MIT License 5 votes vote down vote up
@Bean
public FilterRegistrationBean<SecurityFilter> securityFilterRegistrationBean(EnvConfig envConfig) {
    FilterRegistrationBean<SecurityFilter> registrationBean =
            new FilterRegistrationBean<>(new SecurityFilter(envConfig));
    registrationBean.setOrder(Ordered.HIGHEST_PRECEDENCE + 80); // before nakedDomainFilter
    return registrationBean;
}
 
Example #12
Source File: ApiGatewayApplication.java    From java-microservices-examples with Apache License 2.0 5 votes vote down vote up
@Bean
public FilterRegistrationBean<CorsFilter> simpleCorsFilter() {
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowCredentials(true);
    config.setAllowedOrigins(Collections.singletonList("*"));
    config.setAllowedMethods(Collections.singletonList("*"));
    config.setAllowedHeaders(Collections.singletonList("*"));
    source.registerCorsConfiguration("/**", config);
    FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return bean;
}
 
Example #13
Source File: EmbeddedCacheManagerCustomizerOverrideTest.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Order(Ordered.HIGHEST_PRECEDENCE)
@Bean
public ComponentCustomizer<InfinispanComponent> customizer() {
    return new ComponentCustomizer<InfinispanComponent>() {
        @Override
        public void customize(InfinispanComponent component) {
            component.getConfiguration().setCacheContainer(CACHE_MANAGER);
        }
    };
}
 
Example #14
Source File: GatewayExceptionConfig.java    From spring-microservice-exam with MIT License 5 votes vote down vote up
/**
 * 自定义异常处理
 */
@Primary
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ErrorWebExceptionHandler errorWebExceptionHandler(ObjectProvider<List<ViewResolver>> viewResolversProvider, ServerCodecConfigurer serverCodecConfigurer) {
    GatewayExceptionHandler gatewayExceptionHandler = new GatewayExceptionHandler();
    gatewayExceptionHandler.setViewResolvers(viewResolversProvider.getIfAvailable(Collections::emptyList));
    gatewayExceptionHandler.setMessageWriters(serverCodecConfigurer.getWriters());
    gatewayExceptionHandler.setMessageReaders(serverCodecConfigurer.getReaders());
    return gatewayExceptionHandler;
}
 
Example #15
Source File: CommonAnnotationBeanPostProcessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create a new CommonAnnotationBeanPostProcessor,
 * with the init and destroy annotation types set to
 * {@link javax.annotation.PostConstruct} and {@link javax.annotation.PreDestroy},
 * respectively.
 */
public CommonAnnotationBeanPostProcessor() {
	setOrder(Ordered.LOWEST_PRECEDENCE - 3);
	setInitAnnotationType(PostConstruct.class);
	setDestroyAnnotationType(PreDestroy.class);
	ignoreResourceType("javax.xml.ws.WebServiceContext");
}
 
Example #16
Source File: ErrorHandler.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
    JsonExceptionHandler exceptionHandler = new JsonExceptionHandler(
            errorAttributes,
            this.resourceProperties,
            this.serverProperties.getError(),
            this.applicationContext);
    exceptionHandler.setViewResolvers(this.viewResolvers);
    exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
    exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
    return exceptionHandler;
}
 
Example #17
Source File: ErrorHandlerConfiguration.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
	GlobalExceptionHandler exceptionHandler = new GlobalExceptionHandler(
			errorAttributes,
			this.resourceProperties,
			this.serverProperties.getError(),
			this.applicationContext);
	exceptionHandler.setViewResolvers(this.viewResolvers);
	exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
	exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
	return exceptionHandler;
}
 
Example #18
Source File: EnableAsyncTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void orderAttributeIsPropagated() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(OrderedAsyncConfig.class);
	ctx.refresh();

	AsyncAnnotationBeanPostProcessor bpp = ctx.getBean(AsyncAnnotationBeanPostProcessor.class);
	assertThat(bpp.getOrder(), is(Ordered.HIGHEST_PRECEDENCE));

	ctx.close();
}
 
Example #19
Source File: RemoteCacheManagerCustomizerOverrideTest.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Order(Ordered.HIGHEST_PRECEDENCE)
@Bean
public ComponentCustomizer<InfinispanComponent> customizer() {
    return new ComponentCustomizer<InfinispanComponent>() {
        @Override
        public void customize(InfinispanComponent component) {
            component.getConfiguration().setCacheContainer(CACHE_MANAGER);
        }
    };
}
 
Example #20
Source File: ErrorHandlerConfig.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
    JsonExceptionHandler exceptionHandler = new JsonExceptionHandler(
            errorAttributes, 
            this.resourceProperties,
            this.serverProperties.getError(), 
            this.applicationContext);
    exceptionHandler.setViewResolvers(this.viewResolvers);
    exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
    exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
    return exceptionHandler;
}
 
Example #21
Source File: LogGlobalFilter.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
@Override
public int getOrder() {
    return Ordered.LOWEST_PRECEDENCE;
}
 
Example #22
Source File: MergedAnnotationsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void getDefaultValueFromAnnotation() throws Exception {
	Method method = TransactionalStringGeneric.class.getMethod("something", Object.class);
	MergedAnnotation<Order> annotation = MergedAnnotations.from(method, SearchStrategy.EXHAUSTIVE)
			.get(Order.class);
	assertThat(annotation.getDefaultValue("value")).contains(Ordered.LOWEST_PRECEDENCE);
}
 
Example #23
Source File: ViewResolverRegistryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void contentNegotiation() {
	MappingJackson2JsonView view = new MappingJackson2JsonView();
	this.registry.enableContentNegotiation(view);
	ContentNegotiatingViewResolver resolver = checkAndGetResolver(ContentNegotiatingViewResolver.class);
	assertEquals(Arrays.asList(view), resolver.getDefaultViews());
	assertEquals(Ordered.HIGHEST_PRECEDENCE, this.registry.getOrder());
}
 
Example #24
Source File: CacheManagerCustomizerOverrideTest.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Order(Ordered.HIGHEST_PRECEDENCE)
@Bean
public ComponentCustomizer<EhcacheComponent> customizer() {
    return new ComponentCustomizer<EhcacheComponent>() {
        @Override
        public void customize(EhcacheComponent component) {
            component.setCacheManager(CACHE_MANAGER);
        }
    };
}
 
Example #25
Source File: EnableAsyncTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void orderAttributeIsPropagated() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(OrderedAsyncConfig.class);
	ctx.refresh();

	AsyncAnnotationBeanPostProcessor bpp = ctx.getBean(AsyncAnnotationBeanPostProcessor.class);
	assertThat(bpp.getOrder(), is(Ordered.HIGHEST_PRECEDENCE));

	ctx.close();
}
 
Example #26
Source File: SwaggerConfig.java    From sk-admin with Apache License 2.0 5 votes vote down vote up
@Bean
public AlternateTypeRuleConvention pageableConvention(final TypeResolver resolver) {
    return new AlternateTypeRuleConvention() {
        @Override
        public int getOrder() {
            return Ordered.HIGHEST_PRECEDENCE;
        }

        @Override
        public List<AlternateTypeRule> rules() {
            return newArrayList(newRule(resolver.resolve(Pageable.class), resolver.resolve(Page.class)));
        }
    };
}
 
Example #27
Source File: SimpleBeanFactoryAwareAspectInstanceFactory.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public int getOrder() {
	if (this.beanFactory != null && this.aspectBeanName != null &&
			this.beanFactory.isSingleton(this.aspectBeanName) &&
			this.beanFactory.isTypeMatch(this.aspectBeanName, Ordered.class)) {
		return ((Ordered) this.beanFactory.getBean(this.aspectBeanName)).getOrder();
	}
	return Ordered.LOWEST_PRECEDENCE;
}
 
Example #28
Source File: ErrorHandler.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
    JsonExceptionHandler exceptionHandler = new JsonExceptionHandler(
            errorAttributes,
            this.resourceProperties,
            this.serverProperties.getError(),
            this.applicationContext);
    exceptionHandler.setViewResolvers(this.viewResolvers);
    exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
    exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
    return exceptionHandler;
}
 
Example #29
Source File: ControllerAdviceBean.java    From java-technology-stack with MIT License 5 votes vote down vote up
private static int initOrderFromBeanType(@Nullable Class<?> beanType) {
	Integer order = null;
	if (beanType != null) {
		order = OrderUtils.getOrder(beanType);
	}
	return (order != null ? order : Ordered.LOWEST_PRECEDENCE);
}
 
Example #30
Source File: TransactionUtil.java    From mPass with Apache License 2.0 5 votes vote down vote up
@Override
public int getOrder() {
	if (runner instanceof Ordered) {
		return ((Ordered) runner).getOrder();
	}
	return Ordered.LOWEST_PRECEDENCE;
}