diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle index 2a9d33ce6b..6caf0d42f1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle @@ -69,6 +69,7 @@ dependencies { optional("org.apache.commons:commons-dbcp2") optional("org.apache.kafka:kafka-clients") optional("org.apache.kafka:kafka-streams") + optional("org.apache.solr:solr-solrj") optional("org.apache.tomcat.embed:tomcat-embed-core") optional("org.apache.tomcat.embed:tomcat-embed-el") optional("org.apache.tomcat:tomcat-jdbc") @@ -99,7 +100,6 @@ dependencies { optional("org.springframework.data:spring-data-mongodb") optional("org.springframework.data:spring-data-redis") optional("org.springframework.data:spring-data-elasticsearch") - optional("org.springframework.data:spring-data-solr") optional("org.springframework.integration:spring-integration-core") optional("org.springframework.kafka:spring-kafka") optional("org.springframework.security:spring-security-config") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebEndpointsAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebEndpointsAutoConfigurationIntegrationTests.java index dcc643350a..c25193341f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebEndpointsAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebEndpointsAutoConfigurationIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * 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. @@ -33,7 +33,6 @@ import org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoCo import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration; import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration; -import org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration; import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration; import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; @@ -80,9 +79,8 @@ class WebEndpointsAutoConfigurationIntegrationTests { Neo4jRepositoriesAutoConfiguration.class, MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, MongoReactiveAutoConfiguration.class, MongoReactiveDataAutoConfiguration.class, RepositoryRestMvcAutoConfiguration.class, HazelcastAutoConfiguration.class, - ElasticsearchDataAutoConfiguration.class, SolrRepositoriesAutoConfiguration.class, - SolrAutoConfiguration.class, RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class, - MetricsAutoConfiguration.class }) + ElasticsearchDataAutoConfiguration.class, SolrAutoConfiguration.class, RedisAutoConfiguration.class, + RedisRepositoriesAutoConfiguration.class, MetricsAutoConfiguration.class }) @SpringBootConfiguration static class WebEndpointTestApplication { diff --git a/spring-boot-project/spring-boot-actuator/build.gradle b/spring-boot-project/spring-boot-actuator/build.gradle index 538dfb459f..37f73c13a0 100644 --- a/spring-boot-project/spring-boot-actuator/build.gradle +++ b/spring-boot-project/spring-boot-actuator/build.gradle @@ -34,6 +34,7 @@ dependencies { optional("javax.cache:cache-api") optional("javax.jms:javax.jms-api") optional("net.sf.ehcache:ehcache") + optional("org.apache.solr:solr-solrj") optional("org.apache.tomcat.embed:tomcat-embed-core") optional("org.aspectj:aspectjweaver") optional("org.eclipse.jetty:jetty-server") @@ -60,7 +61,6 @@ dependencies { optional("org.springframework.data:spring-data-mongodb") optional("org.springframework.data:spring-data-redis") optional("org.springframework.data:spring-data-rest-webmvc") - optional("org.springframework.data:spring-data-solr") optional("org.springframework.integration:spring-integration-core") optional("org.springframework.security:spring-security-core") optional("org.springframework.security:spring-security-web") diff --git a/spring-boot-project/spring-boot-autoconfigure/build.gradle b/spring-boot-project/spring-boot-autoconfigure/build.gradle index b1982f8ec0..6cc40d5634 100644 --- a/spring-boot-project/spring-boot-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-autoconfigure/build.gradle @@ -124,7 +124,6 @@ dependencies { optional("org.springframework.data:spring-data-neo4j") optional("org.springframework.data:spring-data-r2dbc") optional("org.springframework.data:spring-data-redis") - optional("org.springframework.data:spring-data-solr") optional("org.springframework.hateoas:spring-hateoas") optional("org.springframework.security:spring-security-acl") optional("org.springframework.security:spring-security-config") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java deleted file mode 100644 index d90b176f4f..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - * 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.autoconfigure.data.solr; - -import org.apache.solr.client.solrj.SolrClient; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.data.solr.repository.SolrRepository; -import org.springframework.data.solr.repository.config.EnableSolrRepositories; -import org.springframework.data.solr.repository.config.SolrRepositoryConfigExtension; -import org.springframework.data.solr.repository.support.SolrRepositoryFactoryBean; - -/** - * Enables auto configuration for Spring Data Solr repositories. - *

- * 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 EnableSolrRepositories @EnableSolrRepositories} would do. - * - * @author Christoph Strobl - * @author Oliver Gierke - * @since 1.1.0 - */ -@Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ SolrClient.class, SolrRepository.class }) -@ConditionalOnMissingBean({ SolrRepositoryFactoryBean.class, SolrRepositoryConfigExtension.class }) -@ConditionalOnProperty(prefix = "spring.data.solr.repositories", name = "enabled", havingValue = "true", - matchIfMissing = true) -@Import(SolrRepositoriesRegistrar.class) -public class SolrRepositoriesAutoConfiguration { - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesRegistrar.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesRegistrar.java deleted file mode 100644 index b5f5cda2d9..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesRegistrar.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - * 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.autoconfigure.data.solr; - -import java.lang.annotation.Annotation; - -import org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport; -import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; -import org.springframework.data.repository.config.RepositoryConfigurationExtension; -import org.springframework.data.solr.repository.config.EnableSolrRepositories; -import org.springframework.data.solr.repository.config.SolrRepositoryConfigExtension; - -/** - * {@link ImportBeanDefinitionRegistrar} used to auto-configure Spring Data Solr - * repositories. - * - * @author Christoph Strobl - */ -class SolrRepositoriesRegistrar extends AbstractRepositoryConfigurationSourceSupport { - - @Override - protected Class getAnnotation() { - return EnableSolrRepositories.class; - } - - @Override - protected Class getConfiguration() { - return EnableSolrRepositoriesConfiguration.class; - } - - @Override - protected RepositoryConfigurationExtension getRepositoryConfigurationExtension() { - return new SolrRepositoryConfigExtension(); - } - - @EnableSolrRepositories - private static class EnableSolrRepositoriesConfiguration { - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/package-info.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/package-info.java deleted file mode 100644 index 9086a52e63..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - * 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. - */ - -/** - * Auto-configuration for Spring Data SOLR. - */ -package org.springframework.boot.autoconfigure.data.solr; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories index aa05666227..ed0fa2ed85 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories @@ -54,7 +54,6 @@ org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.neo4j.Neo4jReactiveDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.neo4j.Neo4jReactiveRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration,\ -org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.r2dbc.R2dbcDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.r2dbc.R2dbcRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/solr/CitySolrRepository.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/solr/CitySolrRepository.java deleted file mode 100644 index 65bf163ae9..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/solr/CitySolrRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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. - * 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.autoconfigure.data.alt.solr; - -import org.springframework.boot.autoconfigure.data.solr.city.City; -import org.springframework.data.repository.Repository; - -public interface CitySolrRepository extends Repository { - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java index 9437f7cf1e..c25490bd50 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * 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. @@ -23,9 +23,9 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; +import org.springframework.boot.autoconfigure.data.alt.elasticsearch.CityElasticsearchDbRepository; import org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository; import org.springframework.boot.autoconfigure.data.alt.mongo.CityMongoDbRepository; -import org.springframework.boot.autoconfigure.data.alt.solr.CitySolrRepository; import org.springframework.boot.autoconfigure.data.jpa.city.City; import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository; import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; @@ -162,7 +162,7 @@ class JpaRepositoriesAutoConfigurationTests { @EnableJpaRepositories( basePackageClasses = org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository.class, excludeFilters = { @Filter(type = FilterType.ASSIGNABLE_TYPE, value = CityMongoDbRepository.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, value = CitySolrRepository.class) }) + @Filter(type = FilterType.ASSIGNABLE_TYPE, value = CityElasticsearchDbRepository.class) }) @TestAutoConfigurationPackage(City.class) static class CustomConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfigurationTests.java deleted file mode 100644 index 7f9b6216bd..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfigurationTests.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - * 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.autoconfigure.data.solr; - -import org.apache.solr.client.solrj.SolrClient; -import org.apache.solr.client.solrj.impl.HttpSolrClient; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; - -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage; -import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.autoconfigure.data.alt.solr.CitySolrRepository; -import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage; -import org.springframework.boot.autoconfigure.data.solr.city.City; -import org.springframework.boot.autoconfigure.data.solr.city.CityRepository; -import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.solr.repository.config.EnableSolrRepositories; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -/** - * Tests for {@link SolrRepositoriesAutoConfiguration}. - * - * @author Christoph Strobl - * @author Oliver Gierke - */ -class SolrRepositoriesAutoConfigurationTests { - - private AnnotationConfigApplicationContext context; - - @AfterEach - void close() { - this.context.close(); - } - - @Test - void testDefaultRepositoryConfiguration() { - initContext(TestConfiguration.class); - assertThat(this.context.getBean(CityRepository.class)).isNotNull(); - assertThat(this.context.getBean(SolrClient.class)).isInstanceOf(HttpSolrClient.class); - } - - @Test - void testNoRepositoryConfiguration() { - initContext(EmptyConfiguration.class); - assertThat(this.context.getBean(SolrClient.class)).isInstanceOf(HttpSolrClient.class); - } - - @Test - void doesNotTriggerDefaultRepositoryDetectionIfCustomized() { - initContext(CustomizedConfiguration.class); - assertThat(this.context.getBean(CitySolrRepository.class)).isNotNull(); - } - - @Test - void autoConfigurationShouldNotKickInEvenIfManualConfigDidNotCreateAnyRepositories() { - initContext(SortOfInvalidCustomConfiguration.class); - assertThatExceptionOfType(NoSuchBeanDefinitionException.class) - .isThrownBy(() -> this.context.getBean(CityRepository.class)); - } - - private void initContext(Class configClass) { - - this.context = new AnnotationConfigApplicationContext(); - this.context.register(configClass, SolrAutoConfiguration.class, SolrRepositoriesAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - } - - @Configuration(proxyBeanMethods = false) - @TestAutoConfigurationPackage(City.class) - static class TestConfiguration { - - } - - @Configuration(proxyBeanMethods = false) - @TestAutoConfigurationPackage(EmptyDataPackage.class) - static class EmptyConfiguration { - - } - - @Configuration(proxyBeanMethods = false) - @TestAutoConfigurationPackage(SolrRepositoriesAutoConfigurationTests.class) - @EnableSolrRepositories(basePackageClasses = CitySolrRepository.class) - static class CustomizedConfiguration { - - } - - @Configuration(proxyBeanMethods = false) - @TestAutoConfigurationPackage(SolrRepositoriesAutoConfigurationTests.class) - // To not find any repositories - @EnableSolrRepositories("foo.bar") - static class SortOfInvalidCustomConfiguration { - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/city/City.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/city/City.java deleted file mode 100644 index 61b73b0e68..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/city/City.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - * 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.autoconfigure.data.solr.city; - -import org.springframework.data.annotation.Id; -import org.springframework.data.solr.core.mapping.Indexed; -import org.springframework.data.solr.core.mapping.SolrDocument; - -/** - * @author Christoph Strobl - */ -@SolrDocument(collection = "collection1") -public class City { - - @Id - private String id; - - @Indexed - private String name; - - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/city/CityRepository.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/city/CityRepository.java deleted file mode 100644 index d2c3928183..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/solr/city/CityRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - * 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.autoconfigure.data.solr.city; - -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.repository.Repository; - -public interface CityRepository extends Repository { - - Page findByNameStartingWith(String name, Pageable page); - -} diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 32ec0e8810..cb7dbd9c79 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -206,7 +206,6 @@ tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) { "spring-data-neo4j-version": versionConstraints["org.springframework.data:spring-data-neo4j"], "spring-data-r2dbc-version": versionConstraints["org.springframework.data:spring-data-r2dbc"], "spring-data-rest-version": versionConstraints["org.springframework.data:spring-data-rest-core"], - "spring-data-solr-version": versionConstraints["org.springframework.data:spring-data-solr"], "spring-framework-version": versionConstraints["org.springframework:spring-core"], "spring-kafka-version": versionConstraints["org.springframework.kafka:spring-kafka"], "spring-integration-version": versionConstraints["org.springframework.integration:spring-integration-core"], diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/attributes.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/attributes.adoc index 021758146d..ba0c8bc45e 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/attributes.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/attributes.adoc @@ -79,8 +79,6 @@ :spring-data-r2dbc-docs: https://docs.spring.io/spring-data/r2dbc/docs/{spring-data-r2dbc-version}/reference/html/ :spring-data-redis: https://spring.io/projects/spring-data-redis :spring-data-rest-api: https://docs.spring.io/spring-data/rest/docs/{spring-data-rest-version}/api/org/springframework/data/rest -:spring-data-solr: https://spring.io/projects/spring-data-solr -:spring-data-solr-docs: https://docs.spring.io/spring-data/solr/docs/{spring-data-solr-version}/reference/html/ :spring-framework: https://spring.io/projects/spring-framework :spring-framework-api: https://docs.spring.io/spring/docs/{spring-framework-version}/javadoc-api/org/springframework :spring-framework-docs: https://docs.spring.io/spring/docs/{spring-framework-version}/reference/html diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc index f40c8dfdf2..9ff65dc9c6 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc @@ -4579,7 +4579,6 @@ Spring Data provides additional projects that help you access a variety of NoSQL * {spring-data-mongodb}[MongoDB] * {spring-data-neo4j}[Neo4J] * {spring-data-elasticsearch}[Elasticsearch] -* {spring-data-solr}[Solr] * {spring-data-redis}[Redis] * {spring-data-gemfire}[GemFire] or {spring-data-geode}[Geode] * {spring-data-cassandra}[Cassandra] @@ -4886,8 +4885,7 @@ include::{code-examples}/neo4j/Neo4jReactiveTransactionManagerExample.java[tag=c [[boot-features-solr]] === Solr https://lucene.apache.org/solr/[Apache Solr] is a search engine. -Spring Boot offers basic auto-configuration for the Solr 5 client library and the 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`" for collecting the dependencies in a convenient way. +Spring Boot offers basic auto-configuration for the Solr 5 client library. @@ -4918,18 +4916,6 @@ If you add your own `@Bean` of type `SolrClient`, it replaces the default. -[[boot-features-spring-data-solr-repositories]] -==== Spring Data Solr Repositories -Spring Data includes repository support for Apache Solr. -As with the JPA repositories discussed earlier, the basic principle is that queries are automatically constructed for you based on method names. - -In fact, both Spring Data JPA and Spring Data Solr share the same common infrastructure. -You could take the JPA example from earlier and, assuming that `City` is now a `@SolrDocument` class rather than a JPA `@Entity`, it works in the same way. - -IP: For complete details of Spring Data Solr, refer to the {spring-data-solr-docs}[reference documentation]. - - - [[boot-features-elasticsearch]] === Elasticsearch https://www.elastic.co/products/elasticsearch[Elasticsearch] is an open source, distributed, RESTful search and analytics engine. diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-data-solr/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-data-solr/build.gradle deleted file mode 100644 index 83a0fd37f3..0000000000 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-data-solr/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -plugins { - id "org.springframework.boot.starter" -} - -description = "Starter for using the Apache Solr search platform with Spring Data Solr" - -dependencies { - api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter")) - api("org.springframework.data:spring-data-solr") { - exclude group: "commons-logging", module: "commons-logging" - exclude group: "org.slf4j", module: "jcl-over-slf4j" - } -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/build.gradle b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/build.gradle deleted file mode 100644 index 73765ae56b..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -plugins { - id "java" - id "org.springframework.boot.conventions" -} - -description = "Spring Boot Data Solr smoke test" - -dependencies { - implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-data-solr")) - - testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test")) -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/Product.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/Product.java deleted file mode 100644 index 76f9eb1e66..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/Product.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2012-2020 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 smoketest.data.solr; - -import java.util.List; - -import org.apache.solr.client.solrj.beans.Field; - -import org.springframework.data.annotation.Id; -import org.springframework.data.solr.core.geo.Point; -import org.springframework.data.solr.core.mapping.SolrDocument; - -@SolrDocument(collection = "collection1") -public class Product { - - @Id - @Field - private String id; - - @Field - private String name; - - @Field - private Double price; - - @Field("cat") - private List category; - - @Field("store") - private Point location; - - public Product() { - } - - public Product(String id, String name) { - this.id = id; - this.name = name; - } - - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public Double getPrice() { - return this.price; - } - - public void setPrice(Double price) { - this.price = price; - } - - public List getCategory() { - return this.category; - } - - public void setCategory(List category) { - this.category = category; - } - - public Point getLocation() { - return this.location; - } - - public void setLocation(Point location) { - this.location = location; - } - - @Override - public String toString() { - return "Product [id=" + this.id + ", name=" + this.name + ", price=" + this.price + ", category=" - + this.category + ", location=" + this.location + "]"; - } - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/ProductRepository.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/ProductRepository.java deleted file mode 100644 index 2ecd22e5b3..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/ProductRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - * 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 smoketest.data.solr; - -import java.util.List; - -import org.springframework.data.solr.repository.SolrCrudRepository; - -public interface ProductRepository extends SolrCrudRepository { - - List findByNameStartingWith(String name); - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/SampleSolrApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/SampleSolrApplication.java deleted file mode 100644 index 19e016edcc..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/SampleSolrApplication.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - * 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 smoketest.data.solr; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SampleSolrApplication implements CommandLineRunner { - - @Autowired - private ProductRepository repository; - - @Override - public void run(String... args) throws Exception { - - this.repository.deleteAll(); - - // insert some products - this.repository.save(new Product("1", "Nintendo Entertainment System")); - this.repository.save(new Product("2", "Sega Megadrive")); - this.repository.save(new Product("3", "Sony Playstation")); - - // fetch all - System.out.println("Products found by findAll():"); - System.out.println("----------------------------"); - for (Product product : this.repository.findAll()) { - System.out.println(product); - } - System.out.println(); - - // fetch a single product - System.out.println("Products found with findByNameStartingWith('So'):"); - System.out.println("--------------------------------"); - for (Product product : this.repository.findByNameStartingWith("So")) { - System.out.println(product); - } - System.out.println(); - } - - public static void main(String[] args) { - SpringApplication.run(SampleSolrApplication.class, args); - } - -} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/test/java/smoketest/data/solr/SampleSolrApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/test/java/smoketest/data/solr/SampleSolrApplicationTests.java deleted file mode 100644 index 36669d7e8e..0000000000 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/test/java/smoketest/data/solr/SampleSolrApplicationTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - * 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 smoketest.data.solr; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import org.springframework.boot.test.system.CapturedOutput; -import org.springframework.boot.test.system.OutputCaptureExtension; -import org.springframework.core.NestedCheckedException; - -import static org.assertj.core.api.Assertions.assertThat; - -@ExtendWith(OutputCaptureExtension.class) -class SampleSolrApplicationTests { - - @Test - void testDefaultSettings(CapturedOutput output) throws Exception { - try { - SampleSolrApplication.main(new String[0]); - } - catch (IllegalStateException ex) { - if (serverNotRunning(ex)) { - return; - } - } - assertThat(output).contains("name=Sony Playstation"); - } - - @SuppressWarnings("serial") - private boolean serverNotRunning(IllegalStateException ex) { - NestedCheckedException nested = new NestedCheckedException("failed", ex) { - }; - Throwable root = nested.getRootCause(); - if (root.getMessage().contains("Connection refused")) { - return true; - } - return false; - } - -}