Java Code Examples for org.springframework.core.annotation.Order

The following examples show how to use org.springframework.core.annotation.Order. These examples are extracted from open source projects. 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 Project: spring-cloud-gateway   Source File: BaseWebClientTests.java    License: Apache License 2.0 6 votes vote down vote up
@Bean
@Order(500)
public GlobalFilter modifyResponseFilter() {
	return (exchange, chain) -> {
		log.info("modifyResponseFilter start");
		String value = exchange.getAttributeOrDefault(GATEWAY_HANDLER_MAPPER_ATTR,
				"N/A");
		if (!exchange.getResponse().isCommitted()) {
			exchange.getResponse().getHeaders().add(HANDLER_MAPPER_HEADER, value);
		}
		Route route = exchange.getAttributeOrDefault(GATEWAY_ROUTE_ATTR, null);
		if (route != null) {
			if (!exchange.getResponse().isCommitted()) {
				exchange.getResponse().getHeaders().add(ROUTE_ID_HEADER,
						route.getId());
			}
		}
		return chain.filter(exchange);
	};
}
 
Example 2
Source Project: webanno   Source File: SessionListener.java    License: Apache License 2.0 6 votes vote down vote up
@EventListener
@Order(Ordered.HIGHEST_PRECEDENCE)
public void onSessionCreated(HttpSessionCreatedEvent aEvent)
{
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication == null) {
        log.trace("Session created for anonymous user [{}]", aEvent.getSession().getId());
        // We don't register anonymous un-authorized sessions.
        // If this were a pre-authenticated session, we'd have an authentication by now.
        // If it is using the form-based login, the login page handles registering the
        // session.
        return;
    }
    
    String username = authentication.getName();
    log.trace("Session created for user [{}] [{}]", username, aEvent.getSession().getId());
    sessionRegistry.registerNewSession(aEvent.getSession().getId(), username);
}
 
Example 3
@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 4
Source Project: mall   Source File: JacksonConfig.java    License: 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 5
Source Project: spring-analysis-note   Source File: MetaAnnotationUtilsTests.java    License: MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void assertAtComponentOnComposedAnnotationForMultipleCandidateTypes(Class<?> startClass,
		Class<?> rootDeclaringClass, Class<?> declaringClass, String name,
		Class<? extends Annotation> composedAnnotationType) {

	Class<Component> annotationType = Component.class;
	UntypedAnnotationDescriptor descriptor = findAnnotationDescriptorForTypes(
			startClass, Service.class, annotationType, Order.class, Transactional.class);

	assertNotNull("UntypedAnnotationDescriptor should not be null", descriptor);
	assertEquals("rootDeclaringClass", rootDeclaringClass, descriptor.getRootDeclaringClass());
	assertEquals("declaringClass", declaringClass, descriptor.getDeclaringClass());
	assertEquals("annotationType", annotationType, descriptor.getAnnotationType());
	assertEquals("component name", name, ((Component) descriptor.getAnnotation()).value());
	assertNotNull("composedAnnotation should not be null", descriptor.getComposedAnnotation());
	assertEquals("composedAnnotationType", composedAnnotationType, descriptor.getComposedAnnotationType());
}
 
Example 6
@ExceptionHandler(value = {SchedulerException.class})
@Order(Ordered.HIGHEST_PRECEDENCE)
public ResponseEntity<ErrorResponse> handleException(SchedulerException e, WebRequest request) {
    ErrorResponse.ErrorResponseBuilder errorBuilder = ErrorResponse.newError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage())
            .clientRequest(request)
            .serverContext()
            .exceptionContext(e);

    switch (e.getErrorCode()) {
        case InvalidArgument:
        case SystemSelectorAlreadyExists:
        case SystemSelectorEvaluationError:
            errorBuilder.status(HttpServletResponse.SC_BAD_REQUEST);
            break;
        case SystemSelectorNotFound:
            errorBuilder.status(HttpServletResponse.SC_NOT_FOUND);
            break;
        default:
            errorBuilder.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
    ErrorResponse errorResponse = errorBuilder.build();
    return ResponseEntity.status(errorResponse.getStatusCode()).body(errorResponse);
}
 
Example 7
Source Project: eclair   Source File: BeanFactoryHelperTest.java    License: Apache License 2.0 6 votes vote down vote up
@Bean({"two", "two1", "two2"})
@Order(2)
public Printer two() {
    return new Printer() {

        @Override
        public boolean supports(Class<?> clazz) {
            return clazz == String.class;
        }

        @Override
        protected String serialize(Object input) {
            return "2";
        }
    };
}
 
Example 8
Source Project: genie   Source File: ExecutionAutoConfiguration.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create a {@link ConfigureExecutionStage} bean if one is not already defined.
 *
 * @param jobRequestConverter           the job request converter
 * @param jobRequestArguments           the job request arguments group
 * @param runtimeConfigurationArguments the runtime configuration arguments group
 * @param cleanupArguments              the cleanup arguments group
 */
@Bean
@Lazy
@Order(30)
@ConditionalOnMissingBean(ConfigureExecutionStage.class)
ConfigureExecutionStage configureExecutionStage(
    final JobRequestConverter jobRequestConverter,
    final ArgumentDelegates.JobRequestArguments jobRequestArguments,
    final ArgumentDelegates.RuntimeConfigurationArguments runtimeConfigurationArguments,
    final ArgumentDelegates.CleanupArguments cleanupArguments
) {
    return new ConfigureExecutionStage(
        jobRequestConverter,
        jobRequestArguments,
        runtimeConfigurationArguments,
        cleanupArguments
    );
}
 
Example 9
Source Project: litemall   Source File: JacksonConfig.java    License: 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 10
Source Project: iot-dc3   Source File: GatewayConfig.java    License: Apache License 2.0 6 votes vote down vote up
@Bean
@Order(-100)
public GlobalFilter globalFilter() {
    return (exchange, chain) -> {
        //调用请求之前统计时间
        Long startTime = System.currentTimeMillis();

        ServerHttpRequest request = exchange.getRequest();
        String remoteIp = Objects.requireNonNull(request.getRemoteAddress()).getHostString();
        R<Boolean> blackIpValid = blackIpClient.checkBlackIpValid(remoteIp);
        if (blackIpValid.isOk()) {
            log.error("Forbidden Ip: {}", remoteIp);
            exchange.getResponse().setStatusCode(HttpStatus.FORBIDDEN);
            return exchange.getResponse().setComplete();
        }
        return chain.filter(exchange).then().then(Mono.fromRunnable(() -> {
            //调用请求之后统计时间
            Long endTime = System.currentTimeMillis();

            log.info("Remote Ip: {}; Request url: {}; Response code: {}; Time: {}ms", remoteIp, request.getURI().getRawPath(), exchange.getResponse().getStatusCode(), (endTime - startTime));
        }));
    };
}
 
Example 11
@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 12
Source Project: genie   Source File: JobsAutoConfiguration.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create an Job Kickoff Task bean that runs the job.
 *
 * @param jobsProperties                     The various jobs properties
 * @param executor                           An instance of an executor
 * @param genieHostInfo                      Info about the host Genie is running on
 * @param registry                           The metrics registry to use
 * @param jobDirectoryManifestCreatorService The manifest creation service
 * @return An application task object
 */
@Bean
@Order(value = 6)
@ConditionalOnMissingBean(JobKickoffTask.class)
public JobKickoffTask jobKickoffTask(
    final JobsProperties jobsProperties,
    final Executor executor,
    final GenieHostInfo genieHostInfo,
    final MeterRegistry registry,
    final JobDirectoryManifestCreatorService jobDirectoryManifestCreatorService
) {
    return new JobKickoffTask(
        jobsProperties.getUsers().isRunAsUserEnabled(),
        jobsProperties.getUsers().isCreationEnabled(),
        executor,
        genieHostInfo.getHostname(),
        registry,
        jobDirectoryManifestCreatorService
    );
}
 
Example 13
Source Project: Cleanstone   Source File: SaveData.java    License: MIT License 6 votes vote down vote up
@Order(value = 50)
@EventListener
public void onTerminate(AsyncPlayerTerminationEvent e) {
    Player player = e.getPlayer();
    if (player.getEntity() == null) {
        return;
    }
    EntityData entityData = new EntityData(player.getEntity().getPosition(),
            player.getEntity().getWorld().getID(), player.getGameMode(), player.isFlying());
    try {
        playerManager.getPlayerDataSource().setPlayerData(player, StandardPlayerDataType.ENTITY_DATA,
                entityData);
    } catch (IOException e1) {
        log.error("Failed to save player data for " + player, e1);
    }
}
 
Example 14
Source Project: synapse   Source File: SynapseAutoConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Configures a {@link de.otto.synapse.endpoint.MessageInterceptor} that is used to add some default
 * message headers when messages are received by a {@link de.otto.synapse.endpoint.receiver.MessageReceiverEndpoint}.
 *
 * @param synapseProperties properties used to configure the interceptor
 * @return DefaultReceiverHeadersInterceptor
 */
@Bean
@Order(LOWEST_PRECEDENCE)
@ConditionalOnMissingBean
@ConditionalOnProperty(
        prefix = "synapse.receiver.default-headers",
        name = "enabled",
        havingValue = "true",
        matchIfMissing = true)
public DefaultReceiverHeadersInterceptor defaultReceiverHeadersInterceptor(final SynapseProperties synapseProperties) {
    return new DefaultReceiverHeadersInterceptor(synapseProperties);
}
 
Example 15
Source Project: microservice-recruit   Source File: GatewayApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Primary
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ErrorWebExceptionHandler errorWebExceptionHandler(ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                                         ServerCodecConfigurer serverCodecConfigurer) {
    ExceptionHandle jsonExceptionHandler = new ExceptionHandle();
    jsonExceptionHandler.setViewResolvers(viewResolversProvider.getIfAvailable(Collections::emptyList));
    jsonExceptionHandler.setMessageWriters(serverCodecConfigurer.getWriters());
    jsonExceptionHandler.setMessageReaders(serverCodecConfigurer.getReaders());
    return jsonExceptionHandler;
}
 
Example 16
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public WebMvcConfigurer webUserTokenInterceptorConfigurer(UserTokenManager userTokenManager,
                                                          AopMethodAuthorizeDefinitionParser parser,
                                                          List<UserTokenParser> userTokenParser) {

    return new WebMvcConfigurerAdapter() {
        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new WebUserTokenInterceptor(userTokenManager, userTokenParser, parser));
            super.addInterceptors(registry);
        }
    };
}
 
Example 17
Source Project: syncope   Source File: SecurityConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
@Order(1)
@ConditionalOnProperty(name = AM_TYPE)
public SecurityWebFilterChain routesSecurityFilterChain(
        final ServerHttpSecurity http,
        final CacheManager cacheManager,
        final LogoutRouteMatcher logoutRouteMatcher,
        final PublicRouteMatcher publicRouteMatcher,
        final CsrfRouteMatcher csrfRouteMatcher,
        final ConfigurableApplicationContext ctx) {

    AMType amType = AMType.valueOf(env.getProperty(AM_TYPE));

    ServerHttpSecurity.AuthorizeExchangeSpec builder = http.authorizeExchange().
            matchers(publicRouteMatcher).permitAll().
            anyExchange().authenticated();

    switch (amType) {
        case OIDC:
        case OAUTH2:
            OAuth2SecurityConfigUtils.forLogin(http, amType, ctx);
            OAuth2SecurityConfigUtils.forLogout(builder, amType, cacheManager, logoutRouteMatcher, ctx);
            break;

        case SAML2:
            break;

        case WA:
        default:
    }

    return builder.and().csrf().requireCsrfProtectionMatcher(csrfRouteMatcher).and().build();
}
 
Example 18
Source Project: Cleanstone   Source File: PlayerMoveListener.java    License: MIT License 5 votes vote down vote up
@Order(EventAction.PREVENT)
@EventListener
public void playerMoveCancellation(PlayerMoveEvent playerMoveEvent) {
    HeadRotatablePosition oldPosition = playerMoveEvent.getOldPosition();
    HeadRotatablePosition newPosition = playerMoveEvent.getNewPosition();

    if (oldPosition.equalCoordinates(newPosition)) {
        return;
    }

    double deltaX = (newPosition.getX() * 32 - oldPosition.getX() * 32) * 128;
    double deltaY = (newPosition.getY() * 32 - oldPosition.getY() * 32) * 128;
    double deltaZ = (newPosition.getZ() * 32 - oldPosition.getZ() * 32) * 128;

    if (isTeleport(deltaX, deltaY, deltaZ)) {
        return;
    }

    Player movingPlayer = playerMoveEvent.getPlayer();
    int entityID = movingPlayer.getEntity().getEntityID();
    float yaw = newPosition.getRotation().getYaw();
    float pitch = newPosition.getRotation().getPitch();

    int chunkX = newPosition.getXAsInt() >> 4;
    int chunkZ = newPosition.getZAsInt() >> 4;

    if (!playerChunkLoadService.hasPlayerLoaded(movingPlayer.getID().getUUID(), ChunkCoords.of(chunkX, chunkZ))) {
        playerMoveEvent.cancel();
    }
}
 
Example 19
/**
 * 自定义日志事件处理
 *
 * @param event 事件
 */
@Async
@Order
@EventListener(CustomLogEvent.class)
public void handleCustomLogEvent(CustomLogEvent event) {
	CustomLogModel model = wrapperLogModel(event);
	logHandler.handleCustomLog(model);
}
 
Example 20
/**
 * 数据权限插件
 *
 * @return DataScopeInterceptor
 */
@Order(10)
@Bean
@ConditionalOnProperty(prefix = DatabaseProperties.PREFIX, name = "isDataScope", havingValue = "true", matchIfMissing = true)
public DataScopeInterceptor dataScopeInterceptor() {
    return new DataScopeInterceptor((userId) -> SpringUtils.getBean(UserApi.class).getDataScopeById(userId));
}
 
Example 21
@ExceptionHandler(value = {RelocationWorkflowException.class})
@Order(Ordered.HIGHEST_PRECEDENCE)
protected ResponseEntity<Object> handleRelocationWorkflowException(RelocationWorkflowException ex, WebRequest request) {
    switch (ex.getErrorCode()) {
        case NotReady:
            return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body("Not ready yet");
        case StoreError:
        default:
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
    }
}
 
Example 22
@Test
@SuppressWarnings("unchecked")
public void findAnnotationDescriptorForTypesForNonInheritedAnnotationOnInterface() throws Exception {
	// Note: @Order is not inherited.
	assertEquals(
		NonInheritedAnnotationInterface.class,
		findAnnotationDescriptorForTypes(NonInheritedAnnotationInterface.class, Order.class).getRootDeclaringClass());
	assertNull(findAnnotationDescriptorForTypes(SubNonInheritedAnnotationInterface.class, Order.class));
}
 
Example 23
Source Project: api-boot   Source File: ApiBootQuartzAutoConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
@Order(1)
public SchedulerFactoryBeanCustomizer jobDataSourceCustomizer(ApiBootQuartzProperties properties, DataSource dataSource, @QuartzDataSource ObjectProvider<DataSource> quartzDataSource, ObjectProvider<PlatformTransactionManager> transactionManager) {
    return (schedulerFactoryBean) -> {
        if (properties.getJobStoreType() == JobStoreType.JDBC) {
            DataSource dataSourceToUse = this.getDataSource(dataSource, quartzDataSource);
            schedulerFactoryBean.setDataSource(dataSourceToUse);
            PlatformTransactionManager txManager = transactionManager.getIfUnique();
            if (txManager != null) {
                schedulerFactoryBean.setTransactionManager(txManager);
            }
        }

    };
}
 
Example 24
Source Project: cuba   Source File: WebExternalUIComponentsSource.java    License: Apache License 2.0 5 votes vote down vote up
@EventListener
@Order(Events.HIGHEST_PLATFORM_PRECEDENCE + 100)
public void init(@SuppressWarnings("unused") AppContextInitializedEvent event) {
    try {
        // register component from app components
        _registerAppComponents();
        //register components from external component jars
        _registerComponents("META-INF/cuba-ui-component.xml");
        //register components from web modules
        _registerComponents("cuba-ui-component.xml");

    } catch (Exception e) {
        log.error("Error on custom UI components registration", e);
    }
}
 
Example 25
@Async
@Order
@EventListener(SysUserOnlineRefreshLastRequestEvent.class)
public void saveSysUserOnlineRefreshLastRequestEvent(SysUserOnlineRefreshLastRequestEvent event) {
	SessionInformation sessionInformation = (SessionInformation) event.getSource();
	UserOnline userOnline = userOnlineService.getById(sessionInformation.getSessionId());
	if (userOnline != null) {
		userOnline.setLastAccessTime(sessionInformation.getLastRequest());
		userOnlineService.updateById(userOnline);
	} else {
		log.debug("sessionInformation sessionId " + sessionInformation.getSessionId() + ", onlineUser is null");
	}

}
 
Example 26
Source Project: spring-cloud-sleuth   Source File: WebClientBraveTests.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Normally, the HTTP connector would be statically initialized. This ensures the
 * {@link HttpClient} is configured for the mock endpoint.
 */
@Bean
@Order(0)
public WebClientCustomizer clientConnectorCustomizer(HttpClient httpClient,
		URI baseUrl) {
	return (builder) -> builder.baseUrl(baseUrl.toString())
			.clientConnector(new ReactorClientHttpConnector(httpClient));
}
 
Example 27
Source Project: piper   Source File: WorkerConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
TaskHandlerResolver taskDispatcherHandlerAdapterResolver (@Lazy TaskHandlerResolver aResolver, Environment aEnvironment) {
  return new TaskDispatcherHandlerAdapterResolver(aResolver,SpelTaskEvaluator.builder()
                                                                              .methodExecutor("tempDir", new TempDir())
                                                                              .environment(aEnvironment)
                                                                              .build());
}
 
Example 28
Source Project: spring-analysis-note   Source File: MetaAnnotationUtilsTests.java    License: MIT License 5 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void findAnnotationDescriptorForTypesForClassWithMetaAnnotatedInterface() {
	Component rawAnnotation = AnnotationUtils.findAnnotation(ClassWithMetaAnnotatedInterface.class, Component.class);

	UntypedAnnotationDescriptor descriptor = findAnnotationDescriptorForTypes(
			ClassWithMetaAnnotatedInterface.class, Service.class, Component.class, Order.class, Transactional.class);

	assertNotNull(descriptor);
	assertEquals(ClassWithMetaAnnotatedInterface.class, descriptor.getRootDeclaringClass());
	assertEquals(Meta1.class, descriptor.getDeclaringClass());
	assertEquals(rawAnnotation, descriptor.getAnnotation());
	assertEquals(Meta1.class, descriptor.getComposedAnnotation().annotationType());
}
 
Example 29
private int getOrder(final Method method) {
    final int order;
    Order ann = AnnotationUtils.findAnnotation(method, Order.class);
    if (ann != null) {
        order = ann.value();
    } else {
        order = LOWEST_PRECEDENCE;
    }
    return order;
}
 
Example 30
Source Project: genie   Source File: JobsAutoConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create an Command Task bean that processes the command needed for a job.
 *
 * @param registry The metrics registry to use
 * @param fts      File transfer implementation
 * @return An command task object
 */
@Bean
@Order(value = 4)
@ConditionalOnMissingBean(CommandTask.class)
public CommandTask commandProcessorTask(
    final MeterRegistry registry,
    @Qualifier("cacheGenieFileTransferService") final GenieFileTransferService fts
) {
    return new CommandTask(registry, fts);
}