mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Polish
This commit changes invocations to immediately return the expression instead of assigning it to a temporary variable. The method name should be sufficient for callers to know exactly what will be returned. Closes gh-12211
This commit is contained in:
parent
c27fa7bf91
commit
98f4692c62
@ -55,9 +55,8 @@ public class JerseyManagementChildContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<ServletContainer> jerseyServletRegistration() {
|
||||
ServletRegistrationBean<ServletContainer> registration = new ServletRegistrationBean<>(
|
||||
return new ServletRegistrationBean<>(
|
||||
new ServletContainer(endpointResourceConfig()), "/*");
|
||||
return registration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -57,8 +57,7 @@ public class ElasticsearchAutoConfiguration {
|
||||
factory.setClusterNodes(this.properties.getClusterNodes());
|
||||
factory.setProperties(createProperties());
|
||||
factory.afterPropertiesSet();
|
||||
TransportClient client = factory.getObject();
|
||||
return client;
|
||||
return factory.getObject();
|
||||
}
|
||||
|
||||
private Properties createProperties() {
|
||||
|
@ -64,9 +64,7 @@ public class Neo4jDataAutoConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public org.neo4j.ogm.config.Configuration configuration(Neo4jProperties properties) {
|
||||
org.neo4j.ogm.config.Configuration configuration = properties
|
||||
.createConfiguration();
|
||||
return configuration;
|
||||
return properties.createConfiguration();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -64,8 +64,7 @@ public class SpringApplicationWebApplicationInitializer
|
||||
|
||||
private Manifest getManifest(ServletContext servletContext) throws IOException {
|
||||
InputStream stream = servletContext.getResourceAsStream("/META-INF/MANIFEST.MF");
|
||||
Manifest manifest = (stream == null ? null : new Manifest(stream));
|
||||
return manifest;
|
||||
return (stream == null ? null : new Manifest(stream));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -235,8 +235,7 @@ public class GroovyCompiler {
|
||||
try {
|
||||
Field field = CompilationUnit.class.getDeclaredField("phaseOperations");
|
||||
field.setAccessible(true);
|
||||
LinkedList[] phaseOperations = (LinkedList[]) field.get(compilationUnit);
|
||||
return phaseOperations;
|
||||
return (LinkedList[]) field.get(compilationUnit);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(
|
||||
|
@ -324,10 +324,9 @@ public class AetherGrapeEngine implements GrapeEngine {
|
||||
}
|
||||
|
||||
private DependencyRequest getDependencyRequest(CollectRequest collectRequest) {
|
||||
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest,
|
||||
return new DependencyRequest(collectRequest,
|
||||
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE,
|
||||
JavaScopes.RUNTIME));
|
||||
return dependencyRequest;
|
||||
}
|
||||
|
||||
private void addManagedDependencies(DependencyResult result) {
|
||||
|
@ -160,8 +160,7 @@ public abstract class ResourceUtils {
|
||||
}
|
||||
else {
|
||||
if (location.startsWith(FILE_URL_PREFIX)) {
|
||||
Resource resource = this.files.getResource(location);
|
||||
return resource;
|
||||
return this.files.getResource(location);
|
||||
}
|
||||
try {
|
||||
// Try to parse the location as a URL...
|
||||
|
@ -112,8 +112,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
|
||||
private BeanDefinition registerBean(BeanDefinitionRegistry registry,
|
||||
AnnotatedBeanDefinitionReader reader, String beanName, Class<?> type) {
|
||||
reader.registerBean(type, beanName);
|
||||
BeanDefinition definition = registry.getBeanDefinition(beanName);
|
||||
return definition;
|
||||
return registry.getBeanDefinition(beanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,8 +135,7 @@ public class SpringBootContextLoader extends AbstractContextLoader {
|
||||
application.setWebApplicationType(WebApplicationType.NONE);
|
||||
}
|
||||
application.setInitializers(initializers);
|
||||
ConfigurableApplicationContext context = application.run();
|
||||
return context;
|
||||
return application.run();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,15 +95,13 @@ public class MetadataStore {
|
||||
}
|
||||
|
||||
private FileObject getMetadataResource() throws IOException {
|
||||
FileObject resource = this.environment.getFiler()
|
||||
return this.environment.getFiler()
|
||||
.getResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
||||
return resource;
|
||||
}
|
||||
|
||||
private FileObject createMetadataResource() throws IOException {
|
||||
FileObject resource = this.environment.getFiler()
|
||||
return this.environment.getFiler()
|
||||
.createResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
||||
return resource;
|
||||
}
|
||||
|
||||
private InputStream getAdditionalMetadataStream() throws IOException {
|
||||
|
@ -68,8 +68,7 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol
|
||||
loader);
|
||||
String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
|
||||
+ ClassUtils.convertClassNameToResourcePath(packageName) + "/**/*.class";
|
||||
Resource[] resources = resolver.getResources(pattern);
|
||||
return resources;
|
||||
return resolver.getResources(pattern);
|
||||
}
|
||||
|
||||
private Class<?> loadClass(ClassLoader loader, MetadataReaderFactory readerFactory,
|
||||
|
Loading…
Reference in New Issue
Block a user