Polish doc code samples
See gh-6313
This commit is contained in:
@@ -37,7 +37,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CloudFoundryCustomContextPathConfiguration {
|
||||
public class MyCloudFoundryConfiguration {
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory servletWebServerFactory() {
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2012-2021 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
|
||||
*
|
||||
* https://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.docs.actuator.endpoints.implementingcustom;
|
||||
|
||||
class CustomData {
|
||||
|
||||
private final String name;
|
||||
|
||||
private final int counter;
|
||||
|
||||
CustomData(String name, int counter) {
|
||||
this.name = name;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
int getCounter() {
|
||||
return this.counter;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,41 +21,20 @@ import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
|
||||
|
||||
@Endpoint(id = "custom")
|
||||
public class CustomEndpoint {
|
||||
public class MyEndpoint {
|
||||
|
||||
// tag::read[]
|
||||
@ReadOperation
|
||||
public CustomData getCustomData() {
|
||||
public CustomData getData() {
|
||||
return new CustomData("test", 5);
|
||||
}
|
||||
// end::read[]
|
||||
|
||||
// tag::write[]
|
||||
@WriteOperation
|
||||
public void updateCustomData(String name, int counter) {
|
||||
public void updateData(String name, int counter) {
|
||||
// injects "test" and 42
|
||||
}
|
||||
// end::write[]
|
||||
|
||||
public static class CustomData {
|
||||
|
||||
private final String name;
|
||||
|
||||
private final int counter;
|
||||
|
||||
public CustomData(String name, int counter) {
|
||||
this.name = name;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getCounter() {
|
||||
return this.counter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MetricsFilterConfiguration {
|
||||
public class MyMetricsFilterConfiguration {
|
||||
|
||||
@Bean
|
||||
public MeterFilter renameRegionTagMeterFilter() {
|
||||
@@ -28,7 +28,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class MyMeterRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
MeterRegistryCustomizer<GraphiteMeterRegistry> graphiteMetricsNamingConvention() {
|
||||
public MeterRegistryCustomizer<GraphiteMeterRegistry> graphiteMetricsNamingConvention() {
|
||||
return (registry) -> registry.config().namingConvention(this::name);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ import io.micrometer.core.instrument.Tags;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MetricsMeterRegistryInjection {
|
||||
public class MyBean {
|
||||
|
||||
private final Dictionary dictionary;
|
||||
|
||||
MetricsMeterRegistryInjection(MeterRegistry registry) {
|
||||
public MyBean(MeterRegistry registry) {
|
||||
this.dictionary = Dictionary.load();
|
||||
registry.gauge("dictionary.size", Tags.empty(), this.dictionary.getWords().size());
|
||||
}
|
||||
@@ -21,10 +21,10 @@ import io.micrometer.core.instrument.binder.MeterBinder;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
public class SampleMeterBinderConfiguration {
|
||||
public class MyMeterBinderConfiguration {
|
||||
|
||||
@Bean
|
||||
MeterBinder queueSize(Queue queue) {
|
||||
public MeterBinder queueSize(Queue queue) {
|
||||
return (registry) -> Gauge.builder("queueSize", queue::size).register(registry);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SampleCommandTagsProviderConfiguration {
|
||||
public class MyCommandTagsProviderConfiguration {
|
||||
|
||||
@Bean
|
||||
MongoCommandTagsProvider customCommandTagsProvider() {
|
||||
public MongoCommandTagsProvider customCommandTagsProvider() {
|
||||
return new CustomCommandTagsProvider();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.mongodb.event.ConnectionPoolCreatedEvent;
|
||||
import io.micrometer.core.instrument.Tag;
|
||||
import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider;
|
||||
|
||||
class CustomConnectionPoolTagsProvider implements MongoConnectionPoolTagsProvider {
|
||||
public class CustomConnectionPoolTagsProvider implements MongoConnectionPoolTagsProvider {
|
||||
|
||||
@Override
|
||||
public Iterable<Tag> connectionPoolTags(ConnectionPoolCreatedEvent event) {
|
||||
|
||||
@@ -22,10 +22,10 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SampleConnectionPoolTagsProviderConfiguration {
|
||||
public class MyConnectionPoolTagsProviderConfiguration {
|
||||
|
||||
@Bean
|
||||
MongoConnectionPoolTagsProvider customConnectionPoolTagsProvider() {
|
||||
public MongoConnectionPoolTagsProvider customConnectionPoolTagsProvider() {
|
||||
return new CustomConnectionPoolTagsProvider();
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.List;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "acme.messaging")
|
||||
public class MessagingProperties {
|
||||
@ConfigurationProperties(prefix = "my.messaging")
|
||||
public class MyMessagingProperties {
|
||||
|
||||
private List<String> addresses = new ArrayList<>(Arrays.asList("a", "b"));
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.boot.docs.configurationmetadata.annotationprocessor.
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "server")
|
||||
public class ServerProperties {
|
||||
@ConfigurationProperties(prefix = "my.server")
|
||||
public class MyServerProperties {
|
||||
|
||||
/**
|
||||
* Name of the server.
|
||||
@@ -18,8 +18,8 @@ package org.springframework.boot.docs.configurationmetadata.annotationprocessor.
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "server")
|
||||
public class ServerProperties {
|
||||
@ConfigurationProperties(prefix = "my.server")
|
||||
public class MyServerProperties {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.boot.docs.configurationmetadata.format.group;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
|
||||
|
||||
@ConfigurationProperties("app.acme")
|
||||
public class AcmeProperties {
|
||||
@ConfigurationProperties("my.app")
|
||||
public class MyProperties {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class AcmeProperties {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@DeprecatedConfigurationProperty(replacement = "app.acme.name")
|
||||
@DeprecatedConfigurationProperty(replacement = "my.app.name")
|
||||
public String getTarget() {
|
||||
return this.name;
|
||||
}
|
||||
@@ -20,8 +20,8 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties("sample")
|
||||
public class SampleProperties {
|
||||
@ConfigurationProperties("my")
|
||||
public class MyProperties {
|
||||
|
||||
private Map<String, Integer> contexts;
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
class MyBean implements EnvironmentAware {
|
||||
public class MyBean implements EnvironmentAware {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String instanceId;
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MathService {
|
||||
public class MyMathService {
|
||||
|
||||
@Cacheable("piDecimals")
|
||||
public int computePiDecimal(int precision) {
|
||||
@@ -21,8 +21,8 @@ import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class CacheManagerCustomizerConfiguration {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyCacheManagerConfiguration {
|
||||
|
||||
@Bean
|
||||
public CacheManagerCustomizer<ConcurrentMapCacheManager> cacheManagerCustomizer() {
|
||||
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CouchbaseCacheManagerConfiguration {
|
||||
public class MyCouchbaseCacheManagerConfiguration {
|
||||
|
||||
@Bean
|
||||
public CouchbaseCacheManagerBuilderCustomizer myCouchbaseCacheManagerBuilderCustomizer() {
|
||||
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class RedisCacheManagerConfiguration {
|
||||
public class MyRedisCacheManagerConfiguration {
|
||||
|
||||
@Bean
|
||||
public RedisCacheManagerBuilderCustomizer myRedisCacheManagerBuilderCustomizer() {
|
||||
@@ -22,15 +22,17 @@ import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportL
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
public class ConditionEvaluationReportTests {
|
||||
public class MyConditionEvaluationReportingTests {
|
||||
|
||||
@Test
|
||||
void autoConfigTest() {
|
||||
ConditionEvaluationReportLoggingListener initializer = new ConditionEvaluationReportLoggingListener(
|
||||
LogLevel.INFO);
|
||||
new ApplicationContextRunner().withInitializer(initializer).run((context) -> {
|
||||
// Test something...
|
||||
});
|
||||
// @formatter:off
|
||||
new ApplicationContextRunner()
|
||||
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO))
|
||||
.run((context) -> {
|
||||
// Test something...
|
||||
});
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.springframework.boot.docs.features.developingautoconfiguration.testing;
|
||||
|
||||
public class UserService {
|
||||
public class MyService {
|
||||
|
||||
private final String name;
|
||||
|
||||
public UserService(String name) {
|
||||
public MyService(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -20,19 +20,19 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.docs.features.developingautoconfiguration.testing.UserServiceAutoConfiguration.UserProperties;
|
||||
import org.springframework.boot.docs.features.developingautoconfiguration.testing.MyServiceAutoConfiguration.UserProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(UserService.class)
|
||||
@ConditionalOnClass(MyService.class)
|
||||
@EnableConfigurationProperties(UserProperties.class)
|
||||
public class UserServiceAutoConfiguration {
|
||||
public class MyServiceAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public UserService userService(UserProperties properties) {
|
||||
return new UserService(properties.getName());
|
||||
public MyService userService(UserProperties properties) {
|
||||
return new MyService(properties.getName());
|
||||
}
|
||||
|
||||
@ConfigurationProperties("user")
|
||||
@@ -26,11 +26,11 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class UserServiceAutoConfigurationTests {
|
||||
class MyServiceAutoConfigurationTests {
|
||||
|
||||
// tag::runner[]
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(UserServiceAutoConfiguration.class));
|
||||
.withConfiguration(AutoConfigurations.of(MyServiceAutoConfiguration.class));
|
||||
|
||||
// end::runner[]
|
||||
|
||||
@@ -38,8 +38,8 @@ class UserServiceAutoConfigurationTests {
|
||||
@Test
|
||||
void serviceNameCanBeConfigured() {
|
||||
this.contextRunner.withPropertyValues("user.name=test123").run((context) -> {
|
||||
assertThat(context).hasSingleBean(UserService.class);
|
||||
assertThat(context.getBean(UserService.class).getName()).isEqualTo("test123");
|
||||
assertThat(context).hasSingleBean(MyService.class);
|
||||
assertThat(context.getBean(MyService.class).getName()).isEqualTo("test123");
|
||||
});
|
||||
}
|
||||
// end::test-env[]
|
||||
@@ -47,8 +47,8 @@ class UserServiceAutoConfigurationTests {
|
||||
// tag::test-classloader[]
|
||||
@Test
|
||||
void serviceIsIgnoredIfLibraryIsNotPresent() {
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader(UserService.class))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean("userService"));
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader(MyService.class))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean("myService"));
|
||||
}
|
||||
// end::test-classloader[]
|
||||
|
||||
@@ -56,8 +56,8 @@ class UserServiceAutoConfigurationTests {
|
||||
@Test
|
||||
void defaultServiceBacksOff() {
|
||||
this.contextRunner.withUserConfiguration(UserConfiguration.class).run((context) -> {
|
||||
assertThat(context).hasSingleBean(UserService.class);
|
||||
assertThat(context).getBean("myUserService").isSameAs(context.getBean(UserService.class));
|
||||
assertThat(context).hasSingleBean(MyService.class);
|
||||
assertThat(context).getBean("myCustomService").isSameAs(context.getBean(MyService.class));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ class UserServiceAutoConfigurationTests {
|
||||
static class UserConfiguration {
|
||||
|
||||
@Bean
|
||||
UserService myUserService() {
|
||||
return new UserService("mine");
|
||||
MyService myCustomService() {
|
||||
return new MyService("mine");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TomcatServerCustomizer implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
|
||||
public class MyTomcatWebServerFactoryCustomizer implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
|
||||
|
||||
@Override
|
||||
public void customize(TomcatServletWebServerFactory server) {
|
||||
@@ -21,7 +21,7 @@ import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerF
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CustomizationBean implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
|
||||
public class MyWebServerFactoryCustomizer implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
|
||||
|
||||
@Override
|
||||
public void customize(ConfigurableServletWebServerFactory server) {
|
||||
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Path("/hello")
|
||||
public class Endpoint {
|
||||
public class MyEndpoint {
|
||||
|
||||
@GET
|
||||
public String message() {
|
||||
@@ -21,10 +21,10 @@ import org.glassfish.jersey.server.ResourceConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class JerseyConfig extends ResourceConfig {
|
||||
public class MyJerseyConfig extends ResourceConfig {
|
||||
|
||||
public JerseyConfig() {
|
||||
register(Endpoint.class);
|
||||
public MyJerseyConfig() {
|
||||
register(MyEndpoint.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class MyRestController {
|
||||
}
|
||||
|
||||
@GetMapping("/{user}/customers")
|
||||
List<Customer> getUserCustomers(@PathVariable Long userId) {
|
||||
public List<Customer> getUserCustomers(@PathVariable Long userId) {
|
||||
return this.userRepository.findById(userId).map(this.customerRepository::findByUser).get();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CorsConfiguration {
|
||||
public class MyCorsConfiguration {
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer corsConfigurer() {
|
||||
@@ -26,12 +26,12 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
|
||||
|
||||
@ControllerAdvice(basePackageClasses = AcmeController.class)
|
||||
@ControllerAdvice(basePackageClasses = SomeController.class)
|
||||
public class MyControllerAdvice extends ResponseEntityExceptionHandler {
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(MyException.class)
|
||||
ResponseEntity<?> handleControllerException(HttpServletRequest request, Throwable ex) {
|
||||
public ResponseEntity<?> handleControllerException(HttpServletRequest request, Throwable ex) {
|
||||
HttpStatus status = getStatus(request);
|
||||
return new ResponseEntity<>(new MyErrorBody(status.value(), ex.getMessage()), status);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
|
||||
package org.springframework.boot.docs.features.developingwebapplications.springmvc.errorhandling;
|
||||
|
||||
class AcmeController {
|
||||
class SomeController {
|
||||
|
||||
}
|
||||
@@ -23,8 +23,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@Configuration
|
||||
public class ErrorPageConfiguration {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyErrorPagesConfiguration {
|
||||
|
||||
@Bean
|
||||
public ErrorPageRegistrar errorPageRegistrar() {
|
||||
@@ -24,8 +24,8 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class ServletFilterConfiguration {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyFilterConfiguration {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<MyFilter> myFilter() {
|
||||
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpMessageConvertersConfiguration {
|
||||
public class MyHttpMessageConvertersConfiguration {
|
||||
|
||||
@Bean
|
||||
public HttpMessageConverters customConverters() {
|
||||
@@ -29,12 +29,12 @@ import static org.springframework.web.reactive.function.server.RequestPredicates
|
||||
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class RoutingConfiguration {
|
||||
public class MyRoutingConfiguration {
|
||||
|
||||
private static final RequestPredicate ACCEPT_JSON = accept(MediaType.APPLICATION_JSON);
|
||||
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> monoRouterFunction(UserHandler userHandler) {
|
||||
public RouterFunction<ServerResponse> monoRouterFunction(MyUserHandler userHandler) {
|
||||
// @formatter:off
|
||||
return route(
|
||||
GET("/{user}").and(ACCEPT_JSON), userHandler::getUser).andRoute(
|
||||
@@ -23,7 +23,7 @@ import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
|
||||
@Component
|
||||
public class UserHandler {
|
||||
public class MyUserHandler {
|
||||
|
||||
public Mono<ServerResponse> getUser(ServerRequest request) {
|
||||
/**/ return ServerResponse.ok().build();
|
||||
@@ -32,9 +32,9 @@ import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse.BodyBuilder;
|
||||
|
||||
@Component
|
||||
public class CustomErrorWebExceptionHandler extends AbstractErrorWebExceptionHandler {
|
||||
public class MyErrorWebExceptionHandler extends AbstractErrorWebExceptionHandler {
|
||||
|
||||
public CustomErrorWebExceptionHandler(ErrorAttributes errorAttributes, Resources resources,
|
||||
public MyErrorWebExceptionHandler(ErrorAttributes errorAttributes, Resources resources,
|
||||
ApplicationContext applicationContext) {
|
||||
super(errorAttributes, resources, applicationContext);
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import org.springframework.web.reactive.result.view.Rendering;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
@Controller
|
||||
public class ExceptionHandlingController {
|
||||
public class MyExceptionHandlingController {
|
||||
|
||||
@GetMapping("/profile")
|
||||
public Rendering userProfile() {
|
||||
@@ -33,7 +33,7 @@ public class ExceptionHandlingController {
|
||||
}
|
||||
|
||||
@ExceptionHandler(IllegalStateException.class)
|
||||
Rendering handleIllegalState(ServerWebExchange exchange, IllegalStateException exc) {
|
||||
public Rendering handleIllegalState(ServerWebExchange exchange, IllegalStateException exc) {
|
||||
exchange.getAttributes().putIfAbsent(ErrorAttributes.ERROR_ATTRIBUTE, exc);
|
||||
return Rendering.view("errorView").modelAttribute("message", exc.getMessage()).build();
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.codec.ServerSentEventHttpMessageReader;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CodecConfiguration {
|
||||
public class MyCodecsConfiguration {
|
||||
|
||||
@Bean
|
||||
public CodecCustomizer myCodecCustomizer() {
|
||||
@@ -24,8 +24,8 @@ import org.springframework.boot.context.properties.ConstructorBinding;
|
||||
import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
|
||||
@ConstructorBinding
|
||||
@ConfigurationProperties("acme")
|
||||
public class AcmeProperties {
|
||||
@ConfigurationProperties("my.service")
|
||||
public class MyProperties {
|
||||
|
||||
// @fold:on // fields...
|
||||
private final boolean enabled;
|
||||
@@ -36,7 +36,7 @@ public class AcmeProperties {
|
||||
|
||||
// @fold:off
|
||||
|
||||
public AcmeProperties(boolean enabled, InetAddress remoteAddress, Security security) {
|
||||
public MyProperties(boolean enabled, InetAddress remoteAddress, Security security) {
|
||||
this.enabled = enabled;
|
||||
this.remoteAddress = remoteAddress;
|
||||
this.security = security;
|
||||
@@ -24,8 +24,8 @@ import org.springframework.boot.context.properties.ConstructorBinding;
|
||||
import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
|
||||
@ConstructorBinding
|
||||
@ConfigurationProperties("acme")
|
||||
public class AcmeProperties {
|
||||
@ConfigurationProperties("my.service")
|
||||
public class MyProperties {
|
||||
|
||||
private final boolean enabled;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AcmeProperties {
|
||||
private final Security security;
|
||||
|
||||
// tag::code[]
|
||||
public AcmeProperties(boolean enabled, InetAddress remoteAddress, @DefaultValue Security security) {
|
||||
public MyProperties(boolean enabled, InetAddress remoteAddress, @DefaultValue Security security) {
|
||||
this.enabled = enabled;
|
||||
this.remoteAddress = remoteAddress;
|
||||
this.security = security;
|
||||
@@ -23,9 +23,9 @@ import org.springframework.boot.convert.DataSizeUnit;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
import org.springframework.util.unit.DataUnit;
|
||||
|
||||
@ConfigurationProperties("app.io")
|
||||
@ConfigurationProperties("my")
|
||||
@ConstructorBinding
|
||||
public class AppIoProperties {
|
||||
public class MyProperties {
|
||||
|
||||
// @fold:on // fields...
|
||||
private final DataSize bufferSize;
|
||||
@@ -33,7 +33,7 @@ public class AppIoProperties {
|
||||
private final DataSize sizeThreshold;
|
||||
|
||||
// @fold:off
|
||||
public AppIoProperties(@DataSizeUnit(DataUnit.MEGABYTES) @DefaultValue("2MB") DataSize bufferSize,
|
||||
public MyProperties(@DataSizeUnit(DataUnit.MEGABYTES) @DefaultValue("2MB") DataSize bufferSize,
|
||||
@DefaultValue("512B") DataSize sizeThreshold) {
|
||||
this.bufferSize = bufferSize;
|
||||
this.sizeThreshold = sizeThreshold;
|
||||
@@ -21,8 +21,8 @@ import org.springframework.boot.convert.DataSizeUnit;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
import org.springframework.util.unit.DataUnit;
|
||||
|
||||
@ConfigurationProperties("app.io")
|
||||
public class AppIoProperties {
|
||||
@ConfigurationProperties("my")
|
||||
public class MyProperties {
|
||||
|
||||
@DataSizeUnit(DataUnit.MEGABYTES)
|
||||
private DataSize bufferSize = DataSize.ofMegabytes(2);
|
||||
@@ -24,9 +24,9 @@ import org.springframework.boot.context.properties.ConstructorBinding;
|
||||
import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
import org.springframework.boot.convert.DurationUnit;
|
||||
|
||||
@ConfigurationProperties("app.system")
|
||||
@ConfigurationProperties("my")
|
||||
@ConstructorBinding
|
||||
public class AppSystemProperties {
|
||||
public class MyProperties {
|
||||
|
||||
// @fold:on // fields...
|
||||
private final Duration sessionTimeout;
|
||||
@@ -34,7 +34,7 @@ public class AppSystemProperties {
|
||||
private final Duration readTimeout;
|
||||
|
||||
// @fold:off
|
||||
public AppSystemProperties(@DurationUnit(ChronoUnit.SECONDS) @DefaultValue("30s") Duration sessionTimeout,
|
||||
public MyProperties(@DurationUnit(ChronoUnit.SECONDS) @DefaultValue("30s") Duration sessionTimeout,
|
||||
@DefaultValue("1000ms") Duration readTimeout) {
|
||||
this.sessionTimeout = sessionTimeout;
|
||||
this.readTimeout = readTimeout;
|
||||
@@ -22,8 +22,8 @@ import java.time.temporal.ChronoUnit;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.convert.DurationUnit;
|
||||
|
||||
@ConfigurationProperties("app.system")
|
||||
public class AppSystemProperties {
|
||||
@ConfigurationProperties("my")
|
||||
public class MyProperties {
|
||||
|
||||
@DurationUnit(ChronoUnit.SECONDS)
|
||||
private Duration sessionTimeout = Duration.ofSeconds(30);
|
||||
@@ -20,7 +20,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
|
||||
@SpringBootApplication
|
||||
@ConfigurationPropertiesScan({ "com.example.app", "org.acme.another" })
|
||||
@ConfigurationPropertiesScan({ "com.example.app", "com.example.another" })
|
||||
public class MyApplication {
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(AcmeProperties.class)
|
||||
@EnableConfigurationProperties(SomeProperties.class)
|
||||
public class MyConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
|
||||
package org.springframework.boot.docs.features.externalconfig.typesafeconfigurationproperties.enablingannotatedtypes;
|
||||
|
||||
class AcmeProperties {
|
||||
class SomeProperties {
|
||||
|
||||
}
|
||||
@@ -23,8 +23,8 @@ import java.util.List;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties("acme")
|
||||
public class AcmeProperties {
|
||||
@ConfigurationProperties("my.service")
|
||||
public class MyProperties {
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.List;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties("acme")
|
||||
public class AcmeProperties {
|
||||
@ConfigurationProperties("my")
|
||||
public class MyProperties {
|
||||
|
||||
private final List<MyPojo> list = new ArrayList<>();
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties("acme")
|
||||
public class AcmeProperties {
|
||||
@ConfigurationProperties("my")
|
||||
public class MyProperties {
|
||||
|
||||
private final Map<String, MyPojo> map = new LinkedHashMap<>();
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.boot.docs.features.externalconfig.typesafeconfigurat
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "acme.my-project.person")
|
||||
public class OwnerProperties {
|
||||
@ConfigurationProperties(prefix = "my.main-project.person")
|
||||
public class MyPersonProperties {
|
||||
|
||||
private String firstName;
|
||||
|
||||
@@ -21,9 +21,9 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class MyService {
|
||||
|
||||
private final AcmeProperties properties;
|
||||
private final SomeProperties properties;
|
||||
|
||||
public MyService(AcmeProperties properties) {
|
||||
public MyService(SomeProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.docs.features.externalconfig.typesafeconfigurationproperties.usingannotatedtypes;
|
||||
|
||||
class AcmeProperties {
|
||||
class SomeProperties {
|
||||
|
||||
Object getRemoteAddress() {
|
||||
return null;
|
||||
@@ -23,9 +23,9 @@ import javax.validation.constraints.NotNull;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ConfigurationProperties(prefix = "acme")
|
||||
@ConfigurationProperties("my.service")
|
||||
@Validated
|
||||
public class AcmeProperties {
|
||||
public class MyProperties {
|
||||
|
||||
@NotNull
|
||||
private InetAddress remoteAddress;
|
||||
@@ -25,9 +25,9 @@ import javax.validation.constraints.NotNull;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ConfigurationProperties(prefix = "acme")
|
||||
@ConfigurationProperties("my.service")
|
||||
@Validated
|
||||
public class AcmeProperties {
|
||||
public class MyProperties {
|
||||
|
||||
@NotNull
|
||||
private InetAddress remoteAddress;
|
||||
@@ -23,7 +23,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class RabbitConfiguration {
|
||||
public class MyRabbitConfiguration {
|
||||
|
||||
@Bean
|
||||
public SimpleRabbitListenerContainerFactory myFactory(SimpleRabbitListenerContainerFactoryConfigurer configurer) {
|
||||
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class JmsConfiguration {
|
||||
public class MyJmsConfiguration {
|
||||
|
||||
@Bean
|
||||
public DefaultJmsListenerContainerFactory myFactory(DefaultJmsListenerContainerFactoryConfigurer configurer) {
|
||||
@@ -21,7 +21,7 @@ import org.springframework.kafka.test.context.EmbeddedKafka;
|
||||
|
||||
@SpringBootTest
|
||||
@EmbeddedKafka(topics = "someTopic", bootstrapServersProperty = "spring.kafka.bootstrap-servers")
|
||||
public class MyTest {
|
||||
class MyTest {
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.kafka.test.EmbeddedKafkaBroker;
|
||||
|
||||
@SpringBootTest
|
||||
public class MyTest {
|
||||
class MyTest {
|
||||
|
||||
// tag::code[]
|
||||
static {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.boot.docs.features.messaging.kafka.sending;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -25,7 +24,6 @@ public class MyBean {
|
||||
|
||||
private final KafkaTemplate<String, String> kafkaTemplate;
|
||||
|
||||
@Autowired
|
||||
public MyBean(KafkaTemplate<String, String> kafkaTemplate) {
|
||||
this.kafkaTemplate = kafkaTemplate;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.kafka.support.serializer.JsonSerde;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableKafkaStreams
|
||||
public class KafkaStreamsConfiguration {
|
||||
public class MyKafkaStreamsConfiguration {
|
||||
|
||||
@Bean
|
||||
public KStream<Integer, String> kStream(StreamsBuilder streamsBuilder) {
|
||||
@@ -24,7 +24,7 @@ import org.springframework.data.couchbase.config.BeanNames;
|
||||
import org.springframework.data.couchbase.core.convert.CouchbaseCustomConversions;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CouchbaseConversionsConfiguration {
|
||||
public class MyCouchbaseConfiguration {
|
||||
|
||||
@Bean(BeanNames.COUCHBASE_CUSTOM_CONVERSIONS)
|
||||
public CouchbaseCustomConversions myCustomConversions() {
|
||||
@@ -24,7 +24,7 @@ import org.springframework.data.neo4j.core.ReactiveDatabaseSelectionProvider;
|
||||
import org.springframework.data.neo4j.core.transaction.ReactiveNeo4jTransactionManager;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class Neo4jReactiveTransactionManagerConfiguration {
|
||||
public class MyNeo4jConfiguration {
|
||||
|
||||
@Bean
|
||||
public ReactiveNeo4jTransactionManager reactiveTransactionManager(Driver driver,
|
||||
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class MyBean {
|
||||
|
||||
private StringRedisTemplate template;
|
||||
private final StringRedisTemplate template;
|
||||
|
||||
public MyBean(StringRedisTemplate template) {
|
||||
this.template = template;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class MyBean {
|
||||
|
||||
private SolrClient solr;
|
||||
private final SolrClient solr;
|
||||
|
||||
public MyBean(SolrClient solr) {
|
||||
this.solr = solr;
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.quartz.JobExecutionException;
|
||||
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
public class SampleJob extends QuartzJobBean {
|
||||
public class MySampleJob extends QuartzJobBean {
|
||||
|
||||
// @fold:on // fields ...
|
||||
private MyService myService;
|
||||
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class RestTemplateBuilderConfiguration {
|
||||
public class MyRestTemplateBuilderConfiguration {
|
||||
|
||||
@Bean
|
||||
public RestTemplateBuilder restTemplateBuilder(RestTemplateBuilderConfigurer configurer) {
|
||||
@@ -29,7 +29,7 @@ import org.springframework.boot.web.client.RestTemplateCustomizer;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
public class RestTemplateProxyCustomizer implements RestTemplateCustomizer {
|
||||
public class MyRestTemplateCustomizer implements RestTemplateCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(RestTemplate restTemplate) {
|
||||
@@ -21,8 +21,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
@Configuration
|
||||
public class OAuthClientConfiguration {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyOAuthClientConfiguration {
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
@@ -23,7 +23,7 @@ import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CustomWebFluxSecurityConfiguration {
|
||||
public class MyWebFluxSecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
@@ -22,9 +22,9 @@ import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ApplicationArgumentsExample {
|
||||
public class MyBean {
|
||||
|
||||
public ApplicationArgumentsExample(ApplicationArguments args) {
|
||||
public MyBean(ApplicationArguments args) {
|
||||
boolean debug = args.containsOption("debug");
|
||||
List<String> files = args.getNonOptionArgs();
|
||||
if (debug) {
|
||||
@@ -22,11 +22,11 @@ import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class LocalCacheVerifier {
|
||||
public class MyLocalCacheVerifier {
|
||||
|
||||
private final ApplicationEventPublisher eventPublisher;
|
||||
|
||||
public LocalCacheVerifier(ApplicationEventPublisher eventPublisher) {
|
||||
public MyLocalCacheVerifier(ApplicationEventPublisher eventPublisher) {
|
||||
this.eventPublisher = eventPublisher;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ReadinessStateExporter {
|
||||
public class MyReadinessStateExporter {
|
||||
|
||||
@EventListener
|
||||
public void onStateChange(AvailabilityChangeEvent<ReadinessState> event) {
|
||||
@@ -20,7 +20,7 @@ import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CommandLineRunnerExample implements CommandLineRunner {
|
||||
public class MyCommandLineRunner implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
@@ -19,7 +19,7 @@ package org.springframework.boot.docs.features.springapplication.fluentbuilderap
|
||||
import org.springframework.boot.Banner;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
|
||||
public class SpringApplicationBuilderExample {
|
||||
public class MyApplication {
|
||||
|
||||
public void hierarchyWithDisabledBanner(String[] args) {
|
||||
// @formatter:off
|
||||
@@ -26,11 +26,11 @@ import org.springframework.stereotype.Component;
|
||||
import static org.springframework.boot.docs.features.sql.jooq.dslcontext.Tables.AUTHOR;
|
||||
|
||||
@Component
|
||||
public class JooqExample {
|
||||
public class MyBean {
|
||||
|
||||
private final DSLContext create;
|
||||
|
||||
public JooqExample(DSLContext dslContext) {
|
||||
public MyBean(DSLContext dslContext) {
|
||||
this.create = dslContext;
|
||||
}
|
||||
|
||||
@@ -25,10 +25,9 @@ import org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryOptionsBuil
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class CustomizeR2dbcPostgresOptionsConfiguration {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyPostgresR2dbcConfiguration {
|
||||
|
||||
// tag::code[]
|
||||
@Bean
|
||||
public ConnectionFactoryOptionsBuilderCustomizer postgresCustomizer() {
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -36,6 +35,5 @@ public class CustomizeR2dbcPostgresOptionsConfiguration {
|
||||
options.put("statement_timeout", "60s");
|
||||
return (builder) -> builder.option(PostgresqlConnectionFactoryProvider.OPTIONS, options);
|
||||
}
|
||||
// end::code[]
|
||||
|
||||
}
|
||||
@@ -22,8 +22,8 @@ import org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryOptionsBuil
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MyR2dbcPortConfiguration {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyR2dbcConfiguration {
|
||||
|
||||
@Bean
|
||||
public ConnectionFactoryOptionsBuilderCustomizer connectionFactoryPortCustomizer() {
|
||||
@@ -22,6 +22,6 @@ import org.springframework.boot.test.autoconfigure.jdbc.JdbcTest;
|
||||
|
||||
@JdbcTest
|
||||
@ImportAutoConfiguration(IntegrationAutoConfiguration.class)
|
||||
class ExampleJdbcTests {
|
||||
class MyJdbcTests {
|
||||
|
||||
}
|
||||
@@ -21,8 +21,8 @@ import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentationConfigurer;
|
||||
import org.springframework.restdocs.templates.TemplateFormats;
|
||||
|
||||
@TestConfiguration
|
||||
public class CustomizationConfiguration implements RestDocsMockMvcConfigurationCustomizer {
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
public class MyRestDocsConfiguration implements RestDocsMockMvcConfigurationCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(MockMvcRestDocumentationConfigurer configurer) {
|
||||
@@ -22,7 +22,7 @@ import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||
import org.springframework.restdocs.mockmvc.RestDocumentationResultHandler;
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
public class ResultHandlerConfiguration {
|
||||
public class MyResultHandlerConfiguration {
|
||||
|
||||
@Bean
|
||||
public RestDocumentationResultHandler restDocumentation() {
|
||||
@@ -30,7 +30,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
@WebMvcTest(UserController.class)
|
||||
@AutoConfigureRestDocs
|
||||
class UserDocumentationTests {
|
||||
class MyUserDocumentationTests {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mvc;
|
||||
@@ -22,7 +22,7 @@ import org.springframework.restdocs.restassured3.RestAssuredRestDocumentationCon
|
||||
import org.springframework.restdocs.templates.TemplateFormats;
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
public class AdvancedRestDocsConfiguration implements RestDocsRestAssuredConfigurationCustomizer {
|
||||
public class MyRestDocsConfiguration implements RestDocsRestAssuredConfigurationCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(RestAssuredRestDocumentationConfigurer configurer) {
|
||||
@@ -31,7 +31,7 @@ import static org.springframework.restdocs.restassured3.RestAssuredRestDocumenta
|
||||
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@AutoConfigureRestDocs
|
||||
class UserDocumentationTests {
|
||||
class MyUserDocumentationTests {
|
||||
|
||||
@Test
|
||||
void listUsers(@Autowired RequestSpecification documentationSpec, @LocalServerPort int port) {
|
||||
@@ -21,7 +21,7 @@ import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.restdocs.webtestclient.WebTestClientRestDocumentationConfigurer;
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
public class AdvancedRestDocsConfiguration implements RestDocsWebTestClientConfigurationCustomizer {
|
||||
public class MyRestDocsConfiguration implements RestDocsWebTestClientConfigurationCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(WebTestClientRestDocumentationConfigurer configurer) {
|
||||
@@ -27,7 +27,7 @@ import static org.springframework.restdocs.webtestclient.WebTestClientRestDocume
|
||||
|
||||
@WebFluxTest
|
||||
@AutoConfigureRestDocs
|
||||
class UsersDocumentationTests {
|
||||
class MyUsersDocumentationTests {
|
||||
|
||||
@Autowired
|
||||
private WebTestClient webTestClient;
|
||||
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(properties = "spring.jmx.enabled=true")
|
||||
@DirtiesContext
|
||||
class SampleJmxTests {
|
||||
class MyJmxTests {
|
||||
|
||||
@Autowired
|
||||
private MBeanServer mBeanServer;
|
||||
@@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.within;
|
||||
|
||||
@JsonTest
|
||||
class AssertJ {
|
||||
class MyJsonAssertJTests {
|
||||
|
||||
@Autowired
|
||||
private JacksonTester<SomeObject> json;
|
||||
@@ -23,7 +23,7 @@ import org.springframework.test.context.TestExecutionListeners;
|
||||
|
||||
@ContextConfiguration(classes = MyConfig.class)
|
||||
@TestExecutionListeners({ MockitoTestExecutionListener.class, ResetMocksTestExecutionListener.class })
|
||||
public class MyTests {
|
||||
class MyTests {
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableBatchProcessing
|
||||
public class SampleApplication {
|
||||
public class MyApplication {
|
||||
|
||||
// ...
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableBatchProcessing
|
||||
public class BatchConfiguration {
|
||||
public class MyBatchConfiguration {
|
||||
|
||||
// ...
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebConfiguration {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyWebConfiguration {
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer testConfigurer() {
|
||||
@@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Component
|
||||
public class TestWebMvcConfigurer implements WebMvcConfigurer {
|
||||
public class MyWebMvcConfigurer implements WebMvcConfigurer {
|
||||
|
||||
// ...
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@SpringBootApplication
|
||||
@ComponentScan({ "com.example.app", "org.acme.another" })
|
||||
public class SampleApplication {
|
||||
@ComponentScan({ "com.example.app", "com.example.another" })
|
||||
public class MyApplication {
|
||||
|
||||
// ...
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(args = "--app.test=one")
|
||||
class ApplicationArgumentTests {
|
||||
class MyApplicationArgumentTests {
|
||||
|
||||
@Test
|
||||
void applicationArgumentsPopulated(@Autowired ApplicationArguments args) {
|
||||
@@ -29,7 +29,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
class MockMvcTests {
|
||||
class MyMockMvcTests {
|
||||
|
||||
@Test
|
||||
void exampleTest(@Autowired MockMvc mvc) throws Exception {
|
||||
@@ -25,7 +25,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
@SpringBootTest
|
||||
@AutoConfigureWebTestClient
|
||||
class MockWebTestClientTests {
|
||||
class MyMockWebTestClientTests {
|
||||
|
||||
@Test
|
||||
void exampleTest(@Autowired WebTestClient webClient) {
|
||||
@@ -26,7 +26,7 @@ import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
class RandomPortTestRestTemplateTests {
|
||||
class MyRandomPortTestRestTemplateTests {
|
||||
|
||||
@Test
|
||||
void exampleTest(@Autowired TestRestTemplate restTemplate) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user