Skip to content

Commit

Permalink
Merge branch '1.4.x' into 1.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Mar 6, 2017
2 parents 3cdc81c + 9fb9a67 commit 28bba87
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,6 +58,7 @@
* @author Phillip Webb
* @author Dave Syer
* @author Ivan Sopov
* @author Stephane Nicoll
*/
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
@Configuration
Expand Down Expand Up @@ -136,17 +137,21 @@ public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
if (ObjectUtils.isEmpty(this.beanFactory.getBeanNamesForType(
EmbeddedServletContainerCustomizerBeanPostProcessor.class, true,
false))) {
RootBeanDefinition beanDefinition = new RootBeanDefinition(
EmbeddedServletContainerCustomizerBeanPostProcessor.class);
beanDefinition.setSynthetic(true);
registry.registerBeanDefinition(
"embeddedServletContainerCustomizerBeanPostProcessor",
new RootBeanDefinition(
EmbeddedServletContainerCustomizerBeanPostProcessor.class));
beanDefinition);

}
if (ObjectUtils.isEmpty(this.beanFactory.getBeanNamesForType(
ErrorPageRegistrarBeanPostProcessor.class, true, false))) {
RootBeanDefinition beanDefinition = new RootBeanDefinition(
ErrorPageRegistrarBeanPostProcessor.class);
beanDefinition.setSynthetic(true);
registry.registerBeanDefinition("errorPageRegistrarBeanPostProcessor",
new RootBeanDefinition(
ErrorPageRegistrarBeanPostProcessor.class));
beanDefinition);

}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,9 +22,10 @@
import java.util.List;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;

/**
Expand All @@ -33,18 +34,18 @@
*
* @author Dave Syer
* @author Phillip Webb
* @author Stephane Nicoll
*/
public class EmbeddedServletContainerCustomizerBeanPostProcessor
implements BeanPostProcessor, ApplicationContextAware {
implements BeanPostProcessor, BeanFactoryAware {

private ApplicationContext applicationContext;
private ListableBeanFactory beanFactory;

private List<EmbeddedServletContainerCustomizer> customizers;

@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.applicationContext = applicationContext;
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = (ListableBeanFactory) beanFactory;
}

@Override
Expand Down Expand Up @@ -73,7 +74,7 @@ private Collection<EmbeddedServletContainerCustomizer> getCustomizers() {
if (this.customizers == null) {
// Look up does not include the parent context
this.customizers = new ArrayList<EmbeddedServletContainerCustomizer>(
this.applicationContext
this.beanFactory
.getBeansOfType(EmbeddedServletContainerCustomizer.class,
false, false)
.values());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,29 +22,30 @@
import java.util.List;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;

/**
* {@link BeanPostProcessor} that applies all {@link ErrorPageRegistrar}s from the bean
* factory to {@link ErrorPageRegistry} beans.
*
* @author Phillip Webb
* @author Stephane Nicoll
* @since 1.4.0
*/
public class ErrorPageRegistrarBeanPostProcessor
implements BeanPostProcessor, ApplicationContextAware {
implements BeanPostProcessor, BeanFactoryAware {

private ApplicationContext applicationContext;
private ListableBeanFactory beanFactory;

private List<ErrorPageRegistrar> registrars;

@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.applicationContext = applicationContext;
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = (ListableBeanFactory) beanFactory;
}

@Override
Expand All @@ -71,7 +72,7 @@ private void postProcessBeforeInitialization(ErrorPageRegistry registry) {
private Collection<ErrorPageRegistrar> getRegistrars() {
if (this.registrars == null) {
// Look up does not include the parent context
this.registrars = new ArrayList<ErrorPageRegistrar>(this.applicationContext
this.registrars = new ArrayList<ErrorPageRegistrar>(this.beanFactory
.getBeansOfType(ErrorPageRegistrar.class, false, false).values());
Collections.sort(this.registrars, AnnotationAwareOrderComparator.INSTANCE);
this.registrars = Collections.unmodifiableList(this.registrars);
Expand Down

0 comments on commit 28bba87

Please sign in to comment.