本文整理汇总了Java中org.springframework.core.annotation.AnnotationAwareOrderComparator.sort方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationAwareOrderComparator.sort方法的具体用法?Java AnnotationAwareOrderComparator.sort怎么用?Java AnnotationAwareOrderComparator.sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.annotation.AnnotationAwareOrderComparator
的用法示例。
在下文中一共展示了AnnotationAwareOrderComparator.sort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jwtTokenEnhancer
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
String keyValue = this.resource.getJwt().getKeyValue();
if (!StringUtils.hasText(keyValue)) {
keyValue = getKeyFromServer();
}
if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
converter.setSigningKey(keyValue);
}
if (keyValue != null) {
converter.setVerifierKey(keyValue);
}
if (!CollectionUtils.isEmpty(this.configurers)) {
AnnotationAwareOrderComparator.sort(this.configurers);
for (JwtAccessTokenConverterConfigurer configurer : this.configurers) {
configurer.configure(converter);
}
}
return converter;
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:22,代码来源:ResourceServerTokenServicesConfiguration.java
示例2: getUserInfoRestTemplate
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
@Override
public OAuth2RestTemplate getUserInfoRestTemplate() {
if (this.oauth2RestTemplate == null) {
this.oauth2RestTemplate = createOAuth2RestTemplate(
this.details == null ? DEFAULT_RESOURCE_DETAILS : this.details);
this.oauth2RestTemplate.getInterceptors()
.add(new AcceptJsonRequestInterceptor());
AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider();
accessTokenProvider.setTokenRequestEnhancer(new AcceptJsonRequestEnhancer());
this.oauth2RestTemplate.setAccessTokenProvider(accessTokenProvider);
if (!CollectionUtils.isEmpty(this.customizers)) {
AnnotationAwareOrderComparator.sort(this.customizers);
for (UserInfoRestTemplateCustomizer customizer : this.customizers) {
customizer.customize(this.oauth2RestTemplate);
}
}
}
return this.oauth2RestTemplate;
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:20,代码来源:DefaultUserInfoRestTemplateFactory.java
示例3: doCreatePropertySources
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* Create {@link PropertySource}s given {@link Environment} from the property
* configuration.
*
* @param environment must not be {@literal null}.
* @return a {@link List} of ordered {@link PropertySource}s.
*/
protected List<PropertySource<?>> doCreatePropertySources(Environment environment) {
Collection<SecretBackendMetadata> secretBackends = propertySourceLocatorConfiguration
.getSecretBackends();
List<SecretBackendMetadata> sorted = new ArrayList<>(secretBackends);
List<PropertySource<?>> propertySources = new ArrayList<>();
AnnotationAwareOrderComparator.sort(sorted);
propertySources.addAll(doCreateGenericPropertySources(environment));
for (SecretBackendMetadata backendAccessor : sorted) {
PropertySource<?> vaultPropertySource = createVaultPropertySource(
backendAccessor);
propertySources.add(vaultPropertySource);
}
return propertySources;
}
示例4: registerConfigItemPostProcessors
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* 注册配置项预处理器
*
* @return
*/
private void registerConfigItemPostProcessors() {
List<ConfigItemPostProcessor> configItemPostProcessors = new ArrayList<>();
configItemPostProcessors.addAll(applicationContext.getBeansOfType(ConfigItemPostProcessor.class).values());
AnnotationAwareOrderComparator.sort(configItemPostProcessors);
this.configItemPostProcessors.addAll(configItemPostProcessors);
}
示例5: registerConfigWatchers
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* 注册配置监听器
*/
private void registerConfigWatchers() {
List<ConfigWatcher> watchers = new ArrayList<>();
watchers.addAll(applicationContext.getBeansOfType(ConfigWatcher.class).values());
AnnotationAwareOrderComparator.sort(watchers);
// 如果没有配置任何监听器,则启动一个默认的轮询监听器
if (CollectionUtils.isEmpty(watchers)) {
ConfigWatcher defaultConfigWatcher = createDefaultConfigWatcher();
watchers.add(defaultConfigWatcher);
}
this.configWatchers.addAll(watchers);
}
示例6: customize
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
private void customize() {
if (this.customizers != null) {
AnnotationAwareOrderComparator.sort(this.customizers);
for (ResteasyConfigCustomizer customizer : this.customizers) {
customizer.customize(this.config);
}
}
}
示例7: jaxrsClientBuilder
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean
public JaxrsClientBuilder jaxrsClientBuilder() {
DefaultJaxrsClientBuilder builder = new DefaultJaxrsClientBuilder();
JaxrsClientBuilderFactory factory = this.clientBuilderFactory.getIfUnique();
if (factory != null) {
builder.setFactory(factory);
}
List<JaxrsClientCustomizer> customizers = this.customizers.getIfAvailable();
if (customizers != null && !customizers.isEmpty()) {
AnnotationAwareOrderComparator.sort(customizers);
customizers.forEach(c -> builder.addCustomizer(c));
}
return builder;
}
示例8: onStartup
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* Delegate the {@code ServletContext} to any {@link WebApplicationInitializer}
* implementations present on the application classpath.
*
* <p>Because this class declares @{@code HandlesTypes(WebApplicationInitializer.class)},
* Servlet 3.0+ containers will automatically scan the classpath for implementations
* of Spring's {@code WebApplicationInitializer} interface and provide the set of all
* such types to the {@code webAppInitializerClasses} parameter of this method.
*
* <p>If no {@code WebApplicationInitializer} implementations are found on the
* classpath, this method is effectively a no-op. An INFO-level log message will be
* issued notifying the user that the {@code ServletContainerInitializer} has indeed
* been invoked but that no {@code WebApplicationInitializer} implementations were
* found.
*
* <p>Assuming that one or more {@code WebApplicationInitializer} types are detected,
* they will be instantiated (and <em>sorted</em> if the @{@link
* org.springframework.core.annotation.Order @Order} annotation is present or
* the {@link org.springframework.core.Ordered Ordered} interface has been
* implemented). Then the {@link WebApplicationInitializer#onStartup(ServletContext)}
* method will be invoked on each instance, delegating the {@code ServletContext} such
* that each instance may register and configure servlets such as Spring's
* {@code DispatcherServlet}, listeners such as Spring's {@code ContextLoaderListener},
* or any other Servlet API componentry such as filters.
*
* @param webAppInitializerClasses all implementations of
* {@link WebApplicationInitializer} found on the application classpath
* @param servletContext the servlet context to be initialized
* @see WebApplicationInitializer#onStartup(ServletContext)
* @see AnnotationAwareOrderComparator
*/
@Override
public void onStartup(Set<Class<?>> webAppInitializerClasses, ServletContext servletContext)
throws ServletException {
List<WebApplicationInitializer> initializers = new LinkedList<WebApplicationInitializer>();
if (webAppInitializerClasses != null) {
for (Class<?> waiClass : webAppInitializerClasses) {
// Be defensive: Some servlet containers provide us with invalid classes,
// no matter what @HandlesTypes says...
if (!waiClass.isInterface() && !Modifier.isAbstract(waiClass.getModifiers()) &&
WebApplicationInitializer.class.isAssignableFrom(waiClass)) {
try {
initializers.add((WebApplicationInitializer) waiClass.newInstance());
}
catch (Throwable ex) {
throw new ServletException("Failed to instantiate WebApplicationInitializer class", ex);
}
}
}
}
if (initializers.isEmpty()) {
servletContext.log("No Spring WebApplicationInitializer types detected on classpath");
return;
}
AnnotationAwareOrderComparator.sort(initializers);
servletContext.log("Spring WebApplicationInitializers detected on classpath: " + initializers);
for (WebApplicationInitializer initializer : initializers) {
initializer.onStartup(servletContext);
}
}
示例9: customizeContext
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* Customize the {@link ConfigurableWebApplicationContext} created by this
* ContextLoader after config locations have been supplied to the context
* but before the context is <em>refreshed</em>.
* <p>The default implementation {@linkplain #determineContextInitializerClasses(ServletContext)
* determines} what (if any) context initializer classes have been specified through
* {@linkplain #CONTEXT_INITIALIZER_CLASSES_PARAM context init parameters} and
* {@linkplain ApplicationContextInitializer#initialize invokes each} with the
* given web application context.
* <p>Any {@code ApplicationContextInitializers} implementing
* {@link org.springframework.core.Ordered Ordered} or marked with @{@link
* org.springframework.core.annotation.Order Order} will be sorted appropriately.
* @param sc the current servlet context
* @param wac the newly created application context
* @see #createWebApplicationContext(ServletContext, ApplicationContext)
* @see #CONTEXT_INITIALIZER_CLASSES_PARAM
* @see ApplicationContextInitializer#initialize(ConfigurableApplicationContext)
*/
protected void customizeContext(ServletContext sc, ConfigurableWebApplicationContext wac) {
List<Class<ApplicationContextInitializer<ConfigurableApplicationContext>>> initializerClasses =
determineContextInitializerClasses(sc);
if (initializerClasses.isEmpty()) {
// no ApplicationContextInitializers have been declared -> nothing to do
return;
}
ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerInstances =
new ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>>();
for (Class<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerClass : initializerClasses) {
Class<?> initializerContextClass =
GenericTypeResolver.resolveTypeArgument(initializerClass, ApplicationContextInitializer.class);
if (initializerContextClass != null) {
Assert.isAssignable(initializerContextClass, wac.getClass(), String.format(
"Could not add context initializer [%s] since its generic parameter [%s] " +
"is not assignable from the type of application context used by this " +
"context loader [%s]: ", initializerClass.getName(), initializerContextClass.getName(),
wac.getClass().getName()));
}
initializerInstances.add(BeanUtils.instantiateClass(initializerClass));
}
AnnotationAwareOrderComparator.sort(initializerInstances);
for (ApplicationContextInitializer<ConfigurableApplicationContext> initializer : initializerInstances) {
initializer.initialize(wac);
}
}
示例10: jwtTokenEnhancer
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
String keyValue = this.resource.getJwt().getKeyValue();
if (!StringUtils.hasText(keyValue)) {
try {
keyValue = getKeyFromServer();
}
catch (ResourceAccessException ex) {
logger.warn("Failed to fetch token key (you may need to refresh "
+ "when the auth server is back)");
}
}
if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
converter.setSigningKey(keyValue);
}
if (keyValue != null) {
converter.setVerifierKey(keyValue);
}
if (!CollectionUtils.isEmpty(this.configurers)) {
AnnotationAwareOrderComparator.sort(this.configurers);
for (JwtAccessTokenConverterConfigurer configurer : this.configurers) {
configurer.configure(converter);
}
}
return converter;
}
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:28,代码来源:ResourceServerTokenServicesConfiguration.java
示例11: addAdvisorsFromAspectInstanceFactory
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* Add all {@link Advisor Advisors} from the supplied {@link MetadataAwareAspectInstanceFactory}
* to the current chain. Exposes any special purpose {@link Advisor Advisors} if needed.
* @see AspectJProxyUtils#makeAdvisorChainAspectJCapableIfNecessary(List)
*/
private void addAdvisorsFromAspectInstanceFactory(MetadataAwareAspectInstanceFactory instanceFactory) {
List<Advisor> advisors = this.aspectFactory.getAdvisors(instanceFactory);
advisors = AopUtils.findAdvisorsThatCanApply(advisors, getTargetClass());
AspectJProxyUtils.makeAdvisorChainAspectJCapableIfNecessary(advisors);
AnnotationAwareOrderComparator.sort(advisors);
addAdvisors(advisors);
}
示例12: getSpringFactoriesInstances
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
private <T> Collection<? extends T> getSpringFactoriesInstances(Class<T> type,
Class<?>[] parameterTypes, Object... args) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// Use names and ensure unique to protect against duplicates
Set<String> names = new LinkedHashSet<String>(
SpringFactoriesLoader.loadFactoryNames(type, classLoader));
List<T> instances = createSpringFactoriesInstances(type, parameterTypes,
classLoader, args, names);
AnnotationAwareOrderComparator.sort(instances);
return instances;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:SpringApplication.java
示例13: extractResolvers
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
private List<HandlerExceptionResolver> extractResolvers() {
List<HandlerExceptionResolver> list = new ArrayList<HandlerExceptionResolver>();
list.addAll(this.beanFactory.getBeansOfType(HandlerExceptionResolver.class)
.values());
list.remove(this);
AnnotationAwareOrderComparator.sort(list);
return list;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:EndpointWebMvcChildContextConfiguration.java
示例14: customize
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* Customize the specified {@link CacheManager}. Locates all
* {@link CacheManagerCustomizer} beans able to handle the specified instance and
* invoke {@link CacheManagerCustomizer#customize(CacheManager)} on them.
* @param <T> the type of cache manager
* @param cacheManager the cache manager to customize
* @return the cache manager
*/
public <T extends CacheManager> T customize(T cacheManager) {
List<CacheManagerCustomizer<CacheManager>> customizers = findCustomizers(
cacheManager);
AnnotationAwareOrderComparator.sort(customizers);
for (CacheManagerCustomizer<CacheManager> customizer : customizers) {
customizer.customize(cacheManager);
}
return cacheManager;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:CacheManagerCustomizers.java
示例15: getEventListenerFactories
import org.springframework.core.annotation.AnnotationAwareOrderComparator; //导入方法依赖的package包/类
/**
* Return the {@link EventListenerFactory} instances to use to handle
* {@link EventListener} annotated methods.
*/
protected List<EventListenerFactory> getEventListenerFactories() {
Map<String, EventListenerFactory> beans = this.applicationContext.getBeansOfType(EventListenerFactory.class);
List<EventListenerFactory> allFactories = new ArrayList<EventListenerFactory>(beans.values());
AnnotationAwareOrderComparator.sort(allFactories);
return allFactories;
}