Unify method visibility of private classes

Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.

Closes gh-7316
This commit is contained in:
Phillip Webb
2019-07-01 12:29:51 -07:00
parent 0a02a3a19c
commit a66c4d3096
910 changed files with 3754 additions and 3945 deletions

View File

@@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
public class MetricsFilterBeanExample {
@Configuration(proxyBeanMethods = false)
static class MetricsFilterExampleConfiguration {
public static class MetricsFilterExampleConfiguration {
// tag::configuration[]
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -21,11 +21,11 @@ package org.springframework.boot.docs.autoconfigure;
*
* @author Stephane Nicoll
*/
class UserService {
public class UserService {
private final String name;
UserService(String name) {
public UserService(String name) {
this.name = name;
}

View File

@@ -41,7 +41,7 @@ public class UserServiceAutoConfiguration {
}
@ConfigurationProperties("user")
static class UserProperties {
public static class UserProperties {
private String name = "test";

View File

@@ -34,7 +34,7 @@ public class TomcatLegacyCookieProcessorExample {
* Configuration class that declares the required {@link WebServerFactoryCustomizer}.
*/
@Configuration(proxyBeanMethods = false)
static class LegacyCookieProcessorConfiguration {
public static class LegacyCookieProcessorConfiguration {
// tag::customizer[]
@Bean

View File

@@ -34,7 +34,7 @@ public class BasicDataSourceExample {
* A configuration that exposes an empty {@link DataSource}.
*/
@Configuration(proxyBeanMethods = false)
static class BasicDataSourceConfiguration {
public static class BasicDataSourceConfiguration {
// tag::configuration[]
@Bean

View File

@@ -37,7 +37,7 @@ public class CompleteTwoDataSourcesExample {
* A complete configuration that exposes two data sources.
*/
@Configuration
static class CompleteDataSourcesConfiguration {
public static class CompleteDataSourcesConfiguration {
// tag::configuration[]
@Bean

View File

@@ -38,7 +38,7 @@ public class ConfigurableDataSourceExample {
* {@link DataSourceProperties}.
*/
@Configuration(proxyBeanMethods = false)
static class ConfigurableDataSourceConfiguration {
public static class ConfigurableDataSourceConfiguration {
// tag::configuration[]
@Bean

View File

@@ -36,7 +36,7 @@ public class SimpleDataSourceExample {
* A simple configuration that exposes dedicated settings.
*/
@Configuration(proxyBeanMethods = false)
static class SimpleDataSourceConfiguration {
public static class SimpleDataSourceConfiguration {
// tag::configuration[]
@Bean

View File

@@ -40,7 +40,7 @@ public class SimpleTwoDataSourcesExample {
* A simple configuration that exposes two data sources.
*/
@Configuration
static class SimpleDataSourcesConfiguration {
public static class SimpleDataSourcesConfiguration {
// tag::configuration[]
@Bean

View File

@@ -37,7 +37,7 @@ public class KafkaStreamsBeanExample {
// tag::configuration[]
@Configuration(proxyBeanMethods = false)
@EnableKafkaStreams
static class KafkaStreamsExampleConfiguration {
public static class KafkaStreamsExampleConfiguration {
@Bean
public KStream<Integer, String> kStream(StreamsBuilder streamsBuilder) {

View File

@@ -70,7 +70,7 @@ class UserServiceAutoConfigurationTests {
static class UserConfiguration {
@Bean
public UserService myUserService() {
UserService myUserService() {
return new UserService("mine");
}

View File

@@ -51,12 +51,12 @@ class TomcatLegacyCookieProcessorExampleTests {
static class TestConfiguration {
@Bean
public TomcatServletWebServerFactory tomcatFactory() {
TomcatServletWebServerFactory tomcatFactory() {
return new TomcatServletWebServerFactory(0);
}
@Bean
public WebServerFactoryCustomizerBeanPostProcessor postProcessor() {
WebServerFactoryCustomizerBeanPostProcessor postProcessor() {
return new WebServerFactoryCustomizerBeanPostProcessor();
}

View File

@@ -43,7 +43,7 @@ class SampleWebClientConfiguration {
private static class ExampleController {
@RequestMapping("/example")
public ResponseEntity<String> example() {
ResponseEntity<String> example() {
return ResponseEntity.ok().location(URI.create("https://other.example.com/example")).body("test");
}

View File

@@ -56,7 +56,7 @@ class SampleWebClientTests {
static class Config {
@Bean
public RestTemplateBuilder restTemplateBuilder() {
RestTemplateBuilder restTemplateBuilder() {
return new RestTemplateBuilder().setConnectTimeout(Duration.ofSeconds(1))
.setReadTimeout(Duration.ofSeconds(1));
}