Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 54 additions & 72 deletions basic/grpc-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,62 @@
<system>GitHub</system>
<url>https://github.com/spring-projects/spring-integration-samples/issues</url>
</issueManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-grpc-client</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-grpc</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.21.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-grpc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-dependencies</artifactId>
<version>1.0.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jdbc</artifactId>
Expand Down Expand Up @@ -328,71 +375,6 @@
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-client-spring-boot-starter</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-grpc</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.29.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.21.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<properties>
<java.version>17</java.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -46,9 +47,12 @@ public class GrpcClientConfiguration {

private static final Log LOGGER = LogFactory.getLog(GrpcClientConfiguration.class);

@Value("${spring.grpc.client.channels.spring-integration.address}")
private String grpcServerAddress;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @Value can simply go to the method argument of the specific bean definition.
There is no need in the dedicated property on the matter.


@Bean
ManagedChannel managedChannel(GrpcChannelFactory factory) {
return factory.createChannel("spring-integration");
return factory.createChannel(this.grpcServerAddress);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
* @author Glenn Renfro
*/
@SpringBootTest(properties = {
"spring.grpc.test.inprocess.enabled=true",
"spring.grpc.test.inprocess.exclusive=true"
"spring.grpc.server.inprocess.name=test",
Comment thread
artembilan marked this conversation as resolved.
"spring.grpc.client.channels.spring-integration.address=in-process:test"
})
@DirtiesContext
@ExtendWith(OutputCaptureExtension.class)
Expand Down
10 changes: 3 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ subprojects { subproject ->
protobufVersion = '4.29.4'
slf4jVersion = '2.0.17'
springCloudVersion = '2025.1.0'
springGrpc = '1.0.2'
springGrpc = '1.1.0-SNAPSHOT'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, do we still need this?
And why then it is not named as springGrpcVersion to align with the rest in this set?

springIntegrationVersion = '7.1.0-SNAPSHOT'
set('spring-integration.version', "$springIntegrationVersion")
springIntegrationSocialTwiterVersion = '1.0.1.BUILD-SNAPSHOT'
Expand Down Expand Up @@ -887,16 +887,12 @@ project('grpc-client') {
apply plugin: 'com.google.protobuf'

dependencies {
implementation platform("org.springframework.grpc:spring-grpc-dependencies:$springGrpc")
implementation 'org.springframework.boot:spring-boot-starter-integration'
implementation "org.springframework.grpc:spring-grpc-client-spring-boot-starter"
implementation "org.springframework.boot:spring-boot-starter-grpc-client"
implementation 'org.springframework.integration:spring-integration-grpc'

implementation("com.google.protobuf:protobuf-java:$protobufVersion")

//Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation "org.springframework.grpc:spring-grpc-test"
testImplementation "org.springframework.boot:spring-boot-starter-grpc-test"

configurations {
testRuntimeOnly.exclude group: 'io.grpc', module: 'grpc-netty'
Expand Down
Loading