Skip to content

Commit

Permalink
add userServiceClient for GraphQl Queries on userService
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlxs committed Dec 6, 2024
1 parent c6f953b commit eca9476
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ dependencies {
implementation 'org.modelmapper:modelmapper:3.+'
implementation 'com.graphql-java:graphql-java-extended-scalars:22.0'
implementation 'com.graphql-java:graphql-java-extended-validation:22.0'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'io.dapr:dapr-sdk:1.9.0' // Dapr's core SDK with all features, except Actors.
implementation 'io.dapr:dapr-sdk-springboot:1.9.0' // Dapr's SDK integration with SpringBoot
implementation 'org.json:json:20240303' // JSON parsing for import from TMS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.unistuttgart.iste.meitrex.assignment_service.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.graphql.client.GraphQlClient;
import org.springframework.graphql.client.HttpGraphQlClient;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
public class UserServiceClientConfiguration {

@Value("${user_service.url}")
private String userServiceUrl;

@Bean
public GraphQlClient userServiceClient() {
final WebClient webClient = WebClient.builder().baseUrl(userServiceUrl).build();
return HttpGraphQlClient.builder(webClient).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.persistence.EntityNotFoundException;
import jakarta.validation.ValidationException;
import lombok.RequiredArgsConstructor;
import org.springframework.graphql.client.GraphQlClient;
import org.springframework.stereotype.Service;
import org.json.*;

Expand All @@ -39,6 +40,8 @@ public class GradingService {
private final TopicPublisher topicPublisher;
private final AssignmentService assignmentService;

private final GraphQlClient userServiceClient;

// these need to be set!
private static final String authToken = "";
private static final String basePath = "";
Expand Down

0 comments on commit eca9476

Please sign in to comment.