mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
Closes gh-8148
This commit is contained in:
parent
8a0f8cf953
commit
846994e498
@ -44,7 +44,7 @@ public class AutoConfigurationImportEvent extends EventObject {
|
||||
/**
|
||||
* Return the auto-configuration candidate configurations that are going to be
|
||||
* imported.
|
||||
* @return the configurations the auto-configuration candidates
|
||||
* @return the auto-configuration candidates
|
||||
*/
|
||||
public List<String> getCandidateConfigurations() {
|
||||
return this.candidateConfigurations;
|
||||
@ -52,7 +52,7 @@ public class AutoConfigurationImportEvent extends EventObject {
|
||||
|
||||
/**
|
||||
* Return the exclusions that were applied.
|
||||
* @return the exclusions the exclusions applied
|
||||
* @return the exclusions applied
|
||||
*/
|
||||
public Set<String> getExclusions() {
|
||||
return this.exclusions;
|
||||
|
@ -31,8 +31,8 @@ import org.springframework.context.ResourceLoaderAware;
|
||||
* methods will be called prior to {@link #match}:
|
||||
* <ul>
|
||||
* <li>{@link EnvironmentAware}</li>
|
||||
* <li>{@link BeanFactoryAware }</li>
|
||||
* <li>{@link BeanClassLoaderAware }</li>
|
||||
* <li>{@link BeanFactoryAware}</li>
|
||||
* <li>{@link BeanClassLoaderAware}</li>
|
||||
* <li>{@link ResourceLoaderAware}</li>
|
||||
* </ul>
|
||||
*
|
||||
|
@ -33,8 +33,8 @@ import org.springframework.context.ResourceLoaderAware;
|
||||
* {@link #onAutoConfigurationImportEvent(AutoConfigurationImportEvent)}:
|
||||
* <ul>
|
||||
* <li>{@link EnvironmentAware}</li>
|
||||
* <li>{@link BeanFactoryAware }</li>
|
||||
* <li>{@link BeanClassLoaderAware }</li>
|
||||
* <li>{@link BeanFactoryAware}</li>
|
||||
* <li>{@link BeanClassLoaderAware}</li>
|
||||
* <li>{@link ResourceLoaderAware}</li>
|
||||
* </ul>
|
||||
*
|
||||
|
@ -99,7 +99,7 @@ public class AutoConfigurationImportSelector
|
||||
checkExcludedClasses(configurations, exclusions);
|
||||
configurations.removeAll(exclusions);
|
||||
configurations = filter(configurations, autoConfigurationMetadata);
|
||||
fireAutoConfigurationImportListeners(configurations, exclusions);
|
||||
fireAutoConfigurationImportEvents(configurations, exclusions);
|
||||
return configurations.toArray(new String[configurations.size()]);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
@ -300,7 +300,7 @@ public class AutoConfigurationImportSelector
|
||||
return Arrays.asList(value == null ? new String[0] : value);
|
||||
}
|
||||
|
||||
private void fireAutoConfigurationImportListeners(List<String> configurations,
|
||||
private void fireAutoConfigurationImportEvents(List<String> configurations,
|
||||
Set<String> exclusions) {
|
||||
List<AutoConfigurationImportListener> listeners = getAutoConfigurationImportListeners();
|
||||
if (!listeners.isEmpty()) {
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
@ -46,7 +45,6 @@ public class EnableAutoConfigurationImportSelectorTests {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
this.importSelector.setBeanFactory(this.beanFactory);
|
||||
this.importSelector.setEnvironment(this.environment);
|
||||
this.importSelector.setResourceLoader(new DefaultResourceLoader());
|
||||
|
@ -3080,7 +3080,7 @@ application's main class to extend `SpringBootServletInitializer`:
|
||||
|
||||
The next step is to update your build configuration so that your project produces a war file
|
||||
rather than a jar file. If you're using Maven and using `spring-boot-starter-parent` (which
|
||||
configures Maven's war plugin for you) all you need to do is modify `pom.xml` to change the
|
||||
configures Maven's war plugin for you) all you need to do is to modify `pom.xml` to change the
|
||||
packaging to war:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
|
@ -1221,7 +1221,7 @@ In addition, any `MetricReader` that you define and mark as `@ExportMetricReader
|
||||
have its values exported by the default exporter.
|
||||
|
||||
NOTE: This feature is enabling scheduling in your application (`@EnableScheduling`) which
|
||||
can be a problem if you run an integration tests as your own scheduled tasks will start.
|
||||
can be a problem if you run an integration test as your own scheduled tasks will start.
|
||||
You can disable this behaviour by setting `spring.metrics.export.enabled` to `false`.
|
||||
|
||||
The default exporter is a `MetricCopyExporter` which tries to optimize itself by not
|
||||
|
@ -1091,7 +1091,7 @@ only rely on custom converters qualified with `@ConfigurationPropertiesBinding`.
|
||||
[[boot-features-external-config-validation]]
|
||||
==== @ConfigurationProperties Validation
|
||||
Spring Boot will attempt to validate `@ConfigurationProperties` classes whenever they
|
||||
annotated with Spring's `@Validated` annotation. You can use JSR-303 `javax.validation`
|
||||
are annotated with Spring's `@Validated` annotation. You can use JSR-303 `javax.validation`
|
||||
constraint annotations directly on your configuration class. Simply ensure that a
|
||||
compliant JSR-303 implementation is on your classpath, then add constraint annotations to
|
||||
your fields:
|
||||
@ -5394,7 +5394,7 @@ more `@AutoConfigure...` annotations that can be used to customize auto-configur
|
||||
settings.
|
||||
|
||||
NOTE: Each slice loads a very restricted set of auto-configuration classes. If you need to
|
||||
exclude one of them, most `@...Test` annotation provide an `excludeAutoConfiguration`
|
||||
exclude one of them, most `@...Test` annotations provide an `excludeAutoConfiguration`
|
||||
attribute. Alternatively, you can use `@ImportAutoConfiguration#exclude`.
|
||||
|
||||
TIP: It's also possible to use the `@AutoConfigure...` annotations with the standard
|
||||
@ -5720,7 +5720,7 @@ for `@Document` classes and configure Spring Data MongoDB repositories. Regular
|
||||
|
||||
In-memory embedded MongoDB generally works well for tests since it is fast and doesn't
|
||||
require any developer installation. If, however, you prefer to run tests against a real
|
||||
MongoDB server you should exclude the embedded mongodb auto-configuration:
|
||||
MongoDB server you should exclude the embedded MongoDB auto-configuration:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
|
@ -1141,7 +1141,7 @@ IDEA suspend the entire VM rather than only suspending the thread that hit the
|
||||
breakpoint. This has the unwanted side-effect of suspending the thread that manages the
|
||||
remote debug tunnel, causing your debugging session to freeze. When using the remote
|
||||
debug tunnel with IntelliJ IDEA, all breakpoints should be configured to suspend the
|
||||
thread rather than the VM. Please set
|
||||
thread rather than the VM. Please see
|
||||
https://youtrack.jetbrains.com/issue/IDEA-165769[IDEA-165769] for further details.
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class DataMongoTestIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void didNotInjectExampleController() {
|
||||
public void didNotInjectExampleService() {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.applicationContext.getBean(ExampleService.class);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class DataMongoTestWithIncludeFilterIntegrationTests {
|
||||
private ExampleService service;
|
||||
|
||||
@Test
|
||||
public void testRepository() {
|
||||
public void testService() {
|
||||
assertThat(this.service.hasCollection("foobar")).isFalse();
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class ExampleService {
|
||||
this.mongoTemplate = mongoTemplate;
|
||||
}
|
||||
|
||||
public boolean hasCollection(final String collectionName) {
|
||||
public boolean hasCollection(String collectionName) {
|
||||
return this.mongoTemplate.collectionExists(collectionName);
|
||||
}
|
||||
|
||||
|
@ -72,11 +72,11 @@ public class TestDatabaseAutoConfigurationTests {
|
||||
}
|
||||
}
|
||||
|
||||
public void load(Class<?> config, String... environment) {
|
||||
private void load(Class<?> config, String... environment) {
|
||||
this.context = doLoad(config, environment);
|
||||
}
|
||||
|
||||
public ConfigurableApplicationContext doLoad(Class<?> config, String... environment) {
|
||||
private ConfigurableApplicationContext doLoad(Class<?> config, String... environment) {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
if (config != null) {
|
||||
ctx.register(config);
|
||||
|
Loading…
Reference in New Issue
Block a user