Spring cloud Angel.SR3 not working for config client - spring

I have an application using spring cloud server and spring cloud client. The spring cloud server has this in POM:
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Angel.SR3</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
This version was upgraded from 1.0.2.BUILD-SNAPSHOT, it is good, but the problem happened for spring cloud client:
This is my current POM parent setting:
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>1.0.0.RELEASE</version>
</parent>
with this version, the env variable can be auto injected from config service, but once I change that to Angel.SR3, the auto injection failed immediately, can not inject environment variable at all.
Is there something wrong from spring cloud here?

After 1.0.0.RELEASE you need to include org.springframework.cloud:spring-cloud-starter-config.

Related

how to import spring-boot-starter-data-solr in spring boot 2.6.4

I'm studying using solr in springboot, I try the program in a book, the spring-boot-starter-parent version is 2.1.2.RELEASE in the book:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
while my spring-boot-starter-parent version is 2.6.4:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
and I add the solr dependency in pom.xml like this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-solr</artifactId>
</dependency>
but the pom.xml shows error: The version cannot be empty, so I go to https://mvnrepository.com/ and find the latest spring-boot-starter-data-solr version is 2.4.13, so I add the solr dependcy like this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-solr</artifactId>
<version>2.4.13</version>
</dependency>
the pom.xml has no error now, but the java program which import solr still not work, such as:
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
it cannot find any class about solr. I also try to download the spring-boot-starter-data-solr jar in https://mvnrepository.com/, and I import it locally, but I only find a META-INF document in the spring-boot-starter-data-solr jar downloaded, it doesn't have any classes
so how should I use solr in springboot?
The Spring Data for Apache Solr project has been discontinued. As a result, it was removed from the Spring Data release train in its 2021.0.0 release and from Spring Boot in its 2.5.0 release.
If you are using Solr directly, rather than via Spring Data, you can continue to do so. You will have to declare your Solr dependencies directly rather than relying on the Data Solr starter and you will have to configure Solr in your application rather than relying on Spring Boot's auto-configuration to do so.
solr-solrj is probably the updated alternative to the not updated spring-data-solr.

spring-boot-starter-parent AND spring version

I'm developing a Java spring web service application. The application has a maven multi module layout, containing a webapp module - and a client module with a retrofit client.
I want to use the spring boot starter to manage my dependencies - and thus my webapp has the entry:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
</parent>
My client needs some Spring types - and this dependency would suufice:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.4.RELEASE</version>
</dependency>
Is there anyway to couple these versions?
You can use Spring Boot without the parent.
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-maven-without-a-parent
So you could add the dependency management to your own parent POM and both modules can use that as parent.

Spring Boot 2.0.5 still using Spring version 4.3.8.RELEASE

I am using Spring boot version 2.0.5 in an IntelliJIdea project. Here is my maven.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath />
<!-- lookup parent from repository -->
</parent>
I verified that it was using Spring version 4.3.8 even though, Springboot's documentation clearly says that Springboot 2.0.X uses Spring version `5.0.X.
After this I overrode the <spring.version> property in the POM file, as shown below:
<properties>
<spring.version>5.1.2.RELEASE</spring.version>
</properties>
Still, the version of Spring my project uses is 4.3.8!
System.out.println("version: " + SpringVersion.getVersion()); . outputs 4.3.8.RELEASE.
Can anyone help me understand how to actually update Springboot's version of the Spring framework used?

ServerRequest on SpringBoot 2.0.0.RELEASE

I recently moved my app. from Spring Boot 1 to Spring Boot 2 (2.0.0.RELEASE).
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
I want to import the class org.springframework.web.reactive.function.server.ServerRequest to get the Error Attributes from the interface
org.springframework.boot.web.reactive.error.ErrorAttributes;
but I got this error:
The import org.springframework.web.reactive.function.server.ServerRequest cannot be resolved
The Spring Boot Reactive Project spring-boot-web-reactive was merged into Spring Webflux with Spring 5.0
Make sure you have webflux Starter on your classpath:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>

Spring Boot minimum version requirement for Spring Cloud Contract to work ?

I'm using latest Spring Boot 1.3 in my client app and I would like to introduce Spring Cloud Contract :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.8.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
I'm able to generate stubs from the producer side, but from consumer side, I'm not able to adapt the example given on https://cloud.spring.io/spring-cloud-contract/ .
I'm replacing the test runner SpringRunner (not available with Spring Boot 1.3) by SpringJUnit4ClassRunner, but the #AutoConfigureStubRunner annotation seems to be ignored.
I don't see any requirement on Spring Boot version mentioned in Spring Cloud Contract page : is there any ?
From my experience, it seems Spring Boot 1.4+ is required. After upgrading to
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
I see #AutoConfigureStubRunner is taken into account.

Resources