mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Refactor Jest auto-configuration package space
This commit moves the Jest auto-configuration from `spring.jest` to `spring.elasticsearch.jest` Closes gh-6032
This commit is contained in:
parent
5182bc4f2b
commit
2dc6e5b6fa
@ -61,7 +61,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadata;
|
||||
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvider;
|
||||
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProviders;
|
||||
import org.springframework.boot.autoconfigure.jest.JestAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
|
@ -48,7 +48,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jest.JestAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jest;
|
||||
package org.springframework.boot.autoconfigure.elasticsearch.jest;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.searchbox.client.JestClient;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jest;
|
||||
package org.springframework.boot.autoconfigure.elasticsearch.jest;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Stephane Nicoll
|
||||
* @since 1.4.0
|
||||
*/
|
||||
@ConfigurationProperties("spring.jest")
|
||||
@ConfigurationProperties("spring.elasticsearch.jest")
|
||||
public class JestProperties {
|
||||
|
||||
/**
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2012-2016 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
|
||||
*
|
||||
* http://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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Auto-configuration for Jest.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.elasticsearch.jest;
|
@ -37,6 +37,7 @@ org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration,\
|
||||
@ -50,7 +51,6 @@ org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jest.JestAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration,\
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jest;
|
||||
package org.springframework.boot.autoconfigure.elasticsearch.jest;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.searchbox.client.JestClient;
|
||||
@ -55,13 +55,13 @@ public class JestAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void customJestClient() {
|
||||
load(CustomJestClient.class, "spring.jest.uris=http://localhost:9200");
|
||||
load(CustomJestClient.class, "spring.elasticsearch.jest.uris=http://localhost:9200");
|
||||
assertThat(this.context.getBeansOfType(JestClient.class)).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customGson() {
|
||||
load(CustomGson.class, "spring.jest.uris=http://localhost:9200");
|
||||
load(CustomGson.class, "spring.elasticsearch.jest.uris=http://localhost:9200");
|
||||
JestHttpClient client = (JestHttpClient) this.context.getBean(JestClient.class);
|
||||
assertThat(client.getGson()).isSameAs(this.context.getBean("customGson"));
|
||||
}
|
@ -624,19 +624,19 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.datasource.url= # JDBC url of the database.
|
||||
spring.datasource.username=
|
||||
|
||||
# JEST (ElasticSearch HTTP client) ({sc-spring-boot-autoconfigure}/jest/JestProperties.{sc-ext}[JestProperties])
|
||||
spring.elasticsearch.jest.connection-timeout=3000 # Connection timeout in milliseconds.
|
||||
spring.elasticsearch.jest.password= # Login password.
|
||||
spring.elasticsearch.jest.read-timeout=3000 # Read timeout in milliseconds.
|
||||
spring.elasticsearch.jest.uris=http://localhost:9200 # Comma-separated list of the elasticsearch instances to use.
|
||||
spring.elasticsearch.jest.username= # Login user.
|
||||
|
||||
# H2 Web Console ({sc-spring-boot-autoconfigure}/h2/H2ConsoleProperties.{sc-ext}[H2ConsoleProperties])
|
||||
spring.h2.console.enabled=false # Enable the console.
|
||||
spring.h2.console.path=/h2-console # Path at which the console will be available.
|
||||
spring.h2.console.settings.trace=false # Enable trace output.
|
||||
spring.h2.console.settings.web-allow-others=false # Enable remote access.
|
||||
|
||||
# JEST (ElasticSearch HTTP client) ({sc-spring-boot-autoconfigure}/jest/JestProperties.{sc-ext}[JestProperties])
|
||||
spring.jest.connection-timeout=3000 # Connection timeout in milliseconds.
|
||||
spring.jest.password= # Login password.
|
||||
spring.jest.read-timeout=3000 # Read timeout in milliseconds.
|
||||
spring.jest.uris=http://localhost:9200 # Comma-separated list of the elasticsearch instances to use.
|
||||
spring.jest.username= # Login user.
|
||||
|
||||
# JOOQ ({sc-spring-boot-autoconfigure}/jooq/JooqAutoConfiguration.{sc-ext}[JooqAutoConfiguration])
|
||||
spring.jooq.sql-dialect= # SQLDialect JOOQ used when communicating with the configured datasource. For instance `POSTGRES`
|
||||
|
||||
|
@ -3342,10 +3342,10 @@ configured:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.jest.uris=http://search.example.com:9200
|
||||
spring.jest.read-timeout=10000
|
||||
spring.jest.username=user
|
||||
spring.jest.password=secret
|
||||
spring.elasticsearch.jest.uris=http://search.example.com:9200
|
||||
spring.elasticsearch.jest.read-timeout=10000
|
||||
spring.elasticsearch.jest.username=user
|
||||
spring.elasticsearch.jest.password=secret
|
||||
----
|
||||
|
||||
To take full control over the registration, define a `JestClient` bean.
|
||||
|
Loading…
Reference in New Issue
Block a user