Refine spring-boot-docs package restructure
Refine the package restructure started in 91ccc23462
to help provide
a solid foundation for code snippets. This commit renames many of the
classes so that they no longer end in `Example`. It also removes some
of the inner types that were previously used. Many tag comments have
also been moved to ensure that `import` statements are available in
the docs.
Closes gh-25089
pull/25115/head
parent
91ccc23462
commit
2a85427324
14
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/CaseSensitiveSpringPhysicalNamingStrategyExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/CaseSensitiveSpringPhysicalNamingStrategyConfiguration.java
14
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/CaseSensitiveSpringPhysicalNamingStrategyExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/CaseSensitiveSpringPhysicalNamingStrategyConfiguration.java
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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.howto.dataaccess;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
* Example configuration for configuring two data sources with what Spring Boot does in
|
||||
* auto-configuration.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CompleteTwoDataSourcesExample {
|
||||
|
||||
/**
|
||||
* A complete configuration that exposes two data sources.
|
||||
*/
|
||||
@Configuration
|
||||
public static class CompleteDataSourcesConfiguration {
|
||||
|
||||
// tag::code[]
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource.first")
|
||||
public DataSourceProperties firstDataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource.first.configuration")
|
||||
public HikariDataSource firstDataSource() {
|
||||
return firstDataSourceProperties().initializeDataSourceBuilder().type(HikariDataSource.class).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource.second")
|
||||
public DataSourceProperties secondDataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource.second.configuration")
|
||||
public BasicDataSource secondDataSource() {
|
||||
return secondDataSourceProperties().initializeDataSourceBuilder().type(BasicDataSource.class).build();
|
||||
}
|
||||
// end::code[]
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.howto.dataaccess;
|
||||
|
||||
// tag::code[]
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class ConfigurableDataSourceConfiguration {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("app.datasource")
|
||||
public DataSourceProperties dataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("app.datasource.configuration")
|
||||
public HikariDataSource dataSource(DataSourceProperties properties) {
|
||||
return properties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
|
||||
}
|
||||
|
||||
}
|
||||
// end::code[]
|
28
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/HibernateSearchElasticsearchExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/ElasticsearchEntityManagerFactoryDependsOnPostProcessor.java
28
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/HibernateSearchElasticsearchExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/ElasticsearchEntityManagerFactoryDependsOnPostProcessor.java
13
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/cloudfoundry/CloudFoundryCustomContextPathExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/cloudfoundry/CloudFoundryCustomContextPathConfiguration.java
13
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/cloudfoundry/CloudFoundryCustomContextPathExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/cloudfoundry/CloudFoundryCustomContextPathConfiguration.java
35
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/MetricsMeterRegistryInjectionExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/MetricsMeterRegistryInjection.java
35
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/MetricsMeterRegistryInjectionExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/productionreadyfeatures/metrics/MetricsMeterRegistryInjection.java
12
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/CouchbaseCacheManagerCustomizationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/CouchbaseCacheManagerConfiguration.java
12
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/CouchbaseCacheManagerCustomizationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/CouchbaseCacheManagerConfiguration.java
12
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/Neo4jReactiveTransactionManagerExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/Neo4jReactiveTransactionManagerConfiguration.java
12
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/Neo4jReactiveTransactionManagerExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/nosql/Neo4jReactiveTransactionManagerConfiguration.java
12
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateBuilderCustomizationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateBuilderConfiguration.java
12
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateBuilderCustomizationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateBuilderConfiguration.java
47
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateProxyCustomizationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateProxyCustomizer.java
47
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateProxyCustomizationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/resttemplate/RestTemplateProxyCustomizer.java
3
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/RandomPortTestRestTemplateExampleTests.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/RandomPortTestRestTemplateTests.java
3
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/RandomPortTestRestTemplateExampleTests.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/RandomPortTestRestTemplateTests.java
9
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/creatingautoconfiguration/UserServiceAutoConfiguration.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/UserServiceAutoConfiguration.java
9
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/creatingautoconfiguration/UserServiceAutoConfiguration.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/UserServiceAutoConfiguration.java
18
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/restassured/AdvancedConfigurationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/restassured/AdvancedRestDocsConfiguration.java
18
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/restassured/AdvancedConfigurationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/restassured/AdvancedRestDocsConfiguration.java
18
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/webclient/AdvancedConfigurationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/webclient/AdvancedRestDocsConfiguration.java
18
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/webclient/AdvancedConfigurationExample.java → spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/springbootfeatures/testing/restdocs/webclient/AdvancedRestDocsConfiguration.java
6
spring-boot-project/spring-boot-docs/src/test/java/org/springframework/boot/docs/howto/springbootapplication/EnvironmentPostProcessorExampleTests.java → spring-boot-project/spring-boot-docs/src/test/java/org/springframework/boot/docs/howto/springbootapplication/ExampleEnvironmentPostProcessorTests.java
6
spring-boot-project/spring-boot-docs/src/test/java/org/springframework/boot/docs/howto/springbootapplication/EnvironmentPostProcessorExampleTests.java → spring-boot-project/spring-boot-docs/src/test/java/org/springframework/boot/docs/howto/springbootapplication/ExampleEnvironmentPostProcessorTests.java
Loading…
Reference in New Issue