parent
269cea291c
commit
275bff39aa
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import org.springframework.context.annotation.DeferredImportSelector;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
|
||||
/**
|
||||
* {@link DeferredImportSelector} to handle {@link EnableAutoConfiguration
|
||||
* auto-configuration}. This class can also be subclassed if a custom variant of
|
||||
* {@link EnableAutoConfiguration @EnableAutoConfiguration}. is needed.
|
||||
*
|
||||
* @deprecated as of 1.5 in favor of {@link AutoConfigurationImportSelector}
|
||||
* @author Phillip Webb
|
||||
* @author Andy Wilkinson
|
||||
* @author Stephane Nicoll
|
||||
* @author Madhura Bhave
|
||||
* @since 1.3.0
|
||||
* @see EnableAutoConfiguration
|
||||
*/
|
||||
@Deprecated
|
||||
public class EnableAutoConfigurationImportSelector
|
||||
extends AutoConfigurationImportSelector {
|
||||
|
||||
@Override
|
||||
protected boolean isEnabled(AnnotationMetadata metadata) {
|
||||
if (getClass().equals(EnableAutoConfigurationImportSelector.class)) {
|
||||
return getEnvironment().getProperty(
|
||||
EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, Boolean.class,
|
||||
true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.ImportSelector;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Phillip Webb
|
||||
* @author Eddú Meléndez
|
||||
* @deprecated as of 1.5 in favor of
|
||||
* {@link org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration}
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Deprecated
|
||||
@Import(MessageSourceAutoConfiguration.Selector.class)
|
||||
public class MessageSourceAutoConfiguration {
|
||||
|
||||
private static final String[] REPLACEMENT = {
|
||||
"org.springframework.boot.autoconfigure.context."
|
||||
+ "MessageSourceAutoConfiguration" };
|
||||
|
||||
static class Selector implements ImportSelector {
|
||||
|
||||
@Override
|
||||
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
|
||||
return REPLACEMENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.ImportSelector;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for
|
||||
* {@link PropertySourcesPlaceholderConfigurer}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
* @deprecated as of 1.5 in favor of
|
||||
* {@link org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration}
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Deprecated
|
||||
@Import(PropertyPlaceholderAutoConfiguration.Selector.class)
|
||||
public class PropertyPlaceholderAutoConfiguration {
|
||||
|
||||
private static final String[] REPLACEMENT = {
|
||||
"org.springframework.boot.autoconfigure.context."
|
||||
+ "PropertyPlaceholderAutoConfiguration" };
|
||||
|
||||
static class Selector implements ImportSelector {
|
||||
|
||||
@Override
|
||||
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
|
||||
return REPLACEMENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.type.StandardAnnotationMetadata;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link EnableAutoConfigurationImportSelector}
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Stephane Nicoll
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class EnableAutoConfigurationImportSelectorTests {
|
||||
|
||||
private final EnableAutoConfigurationImportSelector importSelector = new EnableAutoConfigurationImportSelector();
|
||||
|
||||
private final ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
|
||||
private final MockEnvironment environment = new MockEnvironment();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
this.importSelector.setBeanFactory(this.beanFactory);
|
||||
this.importSelector.setEnvironment(this.environment);
|
||||
this.importSelector.setResourceLoader(new DefaultResourceLoader());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertyOverrideSetToTrue() throws Exception {
|
||||
this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY,
|
||||
"true");
|
||||
String[] imports = selectImports(BasicEnableAutoConfiguration.class);
|
||||
assertThat(imports).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertyOverrideSetToFalse() throws Exception {
|
||||
this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY,
|
||||
"false");
|
||||
String[] imports = selectImports(BasicEnableAutoConfiguration.class);
|
||||
assertThat(imports).isEmpty();
|
||||
}
|
||||
|
||||
private String[] selectImports(Class<?> source) {
|
||||
return this.importSelector.selectImports(new StandardAnnotationMetadata(source));
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
private class BasicEnableAutoConfiguration {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.context.event;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* Event published as early as conceivably possible as soon as a {@link SpringApplication}
|
||||
* has been started - before the {@link Environment} or {@link ApplicationContext} is
|
||||
* available, but after the {@link ApplicationListener}s have been registered. The source
|
||||
* of the event is the {@link SpringApplication} itself, but beware of using its internal
|
||||
* state too much at this early stage since it might be modified later in the lifecycle.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @deprecated as of 1.5 in favor of {@link ApplicationStartingEvent}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("serial")
|
||||
public class ApplicationStartedEvent extends ApplicationStartingEvent {
|
||||
|
||||
/**
|
||||
* Create a new {@link ApplicationStartedEvent} instance.
|
||||
* @param application the current application
|
||||
* @param args the arguments the application is running with
|
||||
*/
|
||||
public ApplicationStartedEvent(SpringApplication application, String[] args) {
|
||||
super(application, args);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue