diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java index c843105d72..5b638a515c 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * 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. @@ -23,7 +23,7 @@ import javax.jms.ConnectionFactory; import javax.sql.DataSource; import com.datastax.driver.core.Cluster; -import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.SolrClient; import org.elasticsearch.client.Client; import org.springframework.amqp.rabbit.core.RabbitTemplate; @@ -269,18 +269,18 @@ public class HealthIndicatorAutoConfiguration { } @Configuration - @ConditionalOnBean(SolrServer.class) + @ConditionalOnBean(SolrClient.class) @ConditionalOnEnabledHealthIndicator("solr") public static class SolrHealthIndicatorConfiguration extends - CompositeHealthIndicatorConfiguration { + CompositeHealthIndicatorConfiguration { @Autowired - private Map solrServers; + private Map solrClients; @Bean @ConditionalOnMissingBean(name = "solrHealthIndicator") public HealthIndicator solrHealthIndicator() { - return createHealthIndicator(this.solrServers); + return createHealthIndicator(this.solrClients); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java index bb286bdad1..338639626f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * 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. @@ -16,7 +16,7 @@ package org.springframework.boot.actuate.health; -import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.SolrClient; /** * {@link HealthIndicator} for Apache Solr. @@ -26,15 +26,15 @@ import org.apache.solr.client.solrj.SolrServer; */ public class SolrHealthIndicator extends AbstractHealthIndicator { - private final SolrServer solrServer; + private final SolrClient solrClient; - public SolrHealthIndicator(SolrServer solrServer) { - this.solrServer = solrServer; + public SolrHealthIndicator(SolrClient solrClient) { + this.solrClient = solrClient; } @Override protected void doHealthCheck(Health.Builder builder) throws Exception { - Object status = this.solrServer.ping().getResponse().get("status"); + Object status = this.solrClient.ping().getResponse().get("status"); builder.up().withDetail("solrStatus", status); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java index 4ffc295dbe..402d1ec156 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * 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. @@ -18,7 +18,7 @@ package org.springframework.boot.actuate.health; import java.io.IOException; -import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.response.SolrPingResponse; import org.apache.solr.common.util.NamedList; import org.junit.After; @@ -55,7 +55,7 @@ public class SolrHealthIndicatorTests { this.context = new AnnotationConfigApplicationContext( PropertyPlaceholderAutoConfiguration.class, SolrAutoConfiguration.class, EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); - assertThat(this.context.getBeanNamesForType(SolrServer.class).length) + assertThat(this.context.getBeanNamesForType(SolrClient.class).length) .isEqualTo(1); SolrHealthIndicator healthIndicator = this.context .getBean(SolrHealthIndicator.class); @@ -64,13 +64,13 @@ public class SolrHealthIndicatorTests { @Test public void solrIsUp() throws Exception { - SolrServer solrServer = mock(SolrServer.class); + SolrClient solrClient = mock(SolrClient.class); SolrPingResponse pingResponse = new SolrPingResponse(); NamedList response = new NamedList(); response.add("status", "OK"); pingResponse.setResponse(response); - given(solrServer.ping()).willReturn(pingResponse); - SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrServer); + given(solrClient.ping()).willReturn(pingResponse); + SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient); Health health = healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails().get("solrStatus")).isEqualTo("OK"); @@ -78,9 +78,9 @@ public class SolrHealthIndicatorTests { @Test public void solrIsDown() throws Exception { - SolrServer solrServer = mock(SolrServer.class); - given(solrServer.ping()).willThrow(new IOException("Connection failed")); - SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrServer); + SolrClient solrClient = mock(SolrClient.class); + given(solrClient.ping()).willThrow(new IOException("Connection failed")); + SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient); Health health = healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(((String) health.getDetails().get("error")) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java index 6950ef2b90..85628cfc83 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * 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. @@ -16,7 +16,7 @@ package org.springframework.boot.autoconfigure.data.solr; -import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.SolrClient; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -30,11 +30,9 @@ import org.springframework.data.solr.repository.support.SolrRepositoryFactoryBea /** * Enables auto configuration for Spring Data Solr repositories. *

- * Activates when there is no bean of type - * {@link org.springframework.data.solr.repository.support.SolrRepositoryFactoryBean} - * found in context, and both - * {@link org.springframework.data.solr.repository.SolrRepository} and - * {@link org.apache.solr.client.solrj.SolrServer} can be found on classpath. + * Activates when there is no bean of type {@link SolrRepositoryFactoryBean} found in + * context, and both {@link SolrRepository} and {@link SolrClient} can be found on + * classpath. *

* If active auto configuration does the same as * {@link org.springframework.data.solr.repository.config.EnableSolrRepositories} would @@ -45,7 +43,7 @@ import org.springframework.data.solr.repository.support.SolrRepositoryFactoryBea * @since 1.1.0 */ @Configuration -@ConditionalOnClass({ SolrServer.class, SolrRepository.class }) +@ConditionalOnClass({ SolrClient.class, SolrRepository.class }) @ConditionalOnMissingBean({ SolrRepositoryFactoryBean.class, SolrRepositoryConfigExtension.class }) @ConditionalOnProperty(prefix = "spring.data.solr.repositories", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.java index 19553f6c16..4c3b6289e2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * 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. @@ -16,12 +16,13 @@ package org.springframework.boot.autoconfigure.solr; +import java.io.IOException; + import javax.annotation.PreDestroy; -import org.apache.solr.client.solrj.SolrServer; -import org.apache.solr.client.solrj.impl.CloudSolrServer; -import org.apache.solr.client.solrj.impl.HttpSolrServer; -import org.apache.solr.common.cloud.HashPartitioner; +import org.apache.solr.client.solrj.SolrClient; +import org.apache.solr.client.solrj.impl.CloudSolrClient; +import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -39,35 +40,34 @@ import org.springframework.util.StringUtils; * @since 1.1.0 */ @Configuration -@ConditionalOnClass({ HttpSolrServer.class, CloudSolrServer.class, - HashPartitioner.class }) +@ConditionalOnClass({HttpSolrClient.class, CloudSolrClient.class}) @EnableConfigurationProperties(SolrProperties.class) public class SolrAutoConfiguration { @Autowired private SolrProperties properties; - private SolrServer solrServer; + private SolrClient solrClient; @PreDestroy - public void close() { - if (this.solrServer != null) { - this.solrServer.shutdown(); + public void close() throws IOException { + if (this.solrClient != null) { + this.solrClient.close(); } } @Bean @ConditionalOnMissingBean - public SolrServer solrServer() { - this.solrServer = createSolrServer(); - return this.solrServer; + public SolrClient solrClient() { + this.solrClient = createSolrClient(); + return this.solrClient; } - private SolrServer createSolrServer() { + private SolrClient createSolrClient() { if (StringUtils.hasText(this.properties.getZkHost())) { - return new CloudSolrServer(this.properties.getZkHost()); + return new CloudSolrClient(this.properties.getZkHost()); } - return new HttpSolrServer(this.properties.getHost()); + return new HttpSolrClient(this.properties.getHost()); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfigurationTests.java index 8bf13321e8..778ee1b864 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * 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. @@ -16,8 +16,8 @@ package org.springframework.boot.autoconfigure.data.solr; -import org.apache.solr.client.solrj.SolrServer; -import org.apache.solr.client.solrj.impl.HttpSolrServer; +import org.apache.solr.client.solrj.SolrClient; +import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.junit.After; import org.junit.Test; @@ -54,15 +54,15 @@ public class SolrRepositoriesAutoConfigurationTests { public void testDefaultRepositoryConfiguration() { initContext(TestConfiguration.class); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); - assertThat(this.context.getBean(SolrServer.class)) - .isInstanceOf(HttpSolrServer.class); + assertThat(this.context.getBean(SolrClient.class)) + .isInstanceOf(HttpSolrClient.class); } @Test public void testNoRepositoryConfiguration() { initContext(EmptyConfiguration.class); - assertThat(this.context.getBean(SolrServer.class)) - .isInstanceOf(HttpSolrServer.class); + assertThat(this.context.getBean(SolrClient.class)) + .isInstanceOf(HttpSolrClient.class); } @Test diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 79a925cab6..aba773bd98 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -66,7 +66,7 @@ 3.2.1 2.3.23 1.5.2 - 8.1.0 + 8.2.0 3.0.0 1.12 2.4.4 @@ -124,13 +124,13 @@ 1.1.1 1.7.15 1.16 - 4.10.4 + 5.3.1 1.0-groovy-2.4 4.2.4.RELEASE 1.5.3.RELEASE 1.2.1.RELEASE 3.0.6.RELEASE - Gosling-SR2A + Hopper-M1 0.19.0.RELEASE 4.2.4.RELEASE 1.2.5.RELEASE diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 39c6ee8371..a574c2fa9c 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -2961,19 +2961,15 @@ https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java [[boot-features-solr]] === Solr http://lucene.apache.org/solr/[Apache Solr] is a search engine. Spring Boot offers basic -auto-configuration for the Solr 4 client library and abstractions on top of it provided by +auto-configuration for the Solr 5 client library and abstractions on top of it provided by https://github.com/spring-projects/spring-data-solr[Spring Data Solr]. There is a `spring-boot-starter-data-solr` '`Starter POM`' for collecting the dependencies in a convenient way. -TIP: Solr 5 is currently not supported and the auto-configuration will not be enabled by -a Solr 5 dependency. - - [[boot-features-connecting-to-solr]] ==== Connecting to Solr -You can inject an auto-configured `SolrServer` instance as you would any other Spring +You can inject an auto-configured `SolrClient` instance as you would any other Spring bean. By default the instance will attempt to connect to a server using `http://localhost:8983/solr`: @@ -2982,10 +2978,10 @@ bean. By default the instance will attempt to connect to a server using @Component public class MyBean { - private SolrServer solr; + private SolrClient solr; @Autowired - public MyBean(SolrServer solr) { + public MyBean(SolrClient solr) { this.solr = solr; } @@ -2994,7 +2990,7 @@ bean. By default the instance will attempt to connect to a server using } ---- -If you add a `@Bean` of your own of type `SolrServer` it will replace the default. +If you add a `@Bean` of your own of type `SolrClient` it will replace the default. diff --git a/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml b/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml index 240ab32c5c..0f056d2ecd 100644 --- a/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml +++ b/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml @@ -36,6 +36,10 @@ org.springframework.data spring-data-gemfire + + org.aspectj + aspectjweaver +