diff --git a/rag/rag-springai-openai-llm/pom.xml b/rag/rag-springai-openai-llm/pom.xml
index 801c3be..670b46f 100644
--- a/rag/rag-springai-openai-llm/pom.xml
+++ b/rag/rag-springai-openai-llm/pom.xml
@@ -45,6 +45,11 @@
org.springframework.ai
spring-ai-tika-document-reader
+
+ org.apache.commons
+ commons-compress
+ 1.27.1
+
org.springframework.retry
spring-retry
diff --git a/rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/config/ResponseHeadersModification.java b/rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/config/ResponseHeadersModification.java
index 2fb9e2c..2a51457 100644
--- a/rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/config/ResponseHeadersModification.java
+++ b/rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/config/ResponseHeadersModification.java
@@ -9,8 +9,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.web.client.ClientHttpRequestFactories;
-import org.springframework.boot.web.client.ClientHttpRequestFactorySettings;
+import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
import org.springframework.boot.web.client.RestClientCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -34,7 +33,7 @@ class ResponseHeadersModification {
RestClientCustomizer restClientCustomizer() {
return restClientBuilder -> restClientBuilder
.requestFactory(new BufferingClientHttpRequestFactory(
- ClientHttpRequestFactories.get(ClientHttpRequestFactorySettings.DEFAULTS)))
+ ClientHttpRequestFactoryBuilder.detect().build()))
.requestInterceptor((request, body, execution) -> {
logRequest(request, body);
ClientHttpResponse response = execution.execute(request, body);
diff --git a/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/TestLlmRagWithSpringAiApplication.java b/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/TestLlmRagWithSpringAiApplication.java
index a7d8650..87bf7f7 100644
--- a/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/TestLlmRagWithSpringAiApplication.java
+++ b/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/TestLlmRagWithSpringAiApplication.java
@@ -1,24 +1,13 @@
package com.learning.ai.llmragwithspringai;
+import com.learning.ai.llmragwithspringai.config.ContainersConfig;
import org.springframework.boot.SpringApplication;
-import org.springframework.boot.test.context.TestConfiguration;
-import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
-import org.springframework.context.annotation.Bean;
-import org.testcontainers.containers.PostgreSQLContainer;
-import org.testcontainers.utility.DockerImageName;
-@TestConfiguration(proxyBeanMethods = false)
public class TestLlmRagWithSpringAiApplication {
- @Bean
- @ServiceConnection
- PostgreSQLContainer> pgvectorContainer() {
- return new PostgreSQLContainer<>(DockerImageName.parse("pgvector/pgvector:pg17"));
- }
-
public static void main(String[] args) {
SpringApplication.from(LlmRagWithSpringAiApplication::main)
- .with(TestLlmRagWithSpringAiApplication.class)
+ .with(ContainersConfig.class)
.run(args);
}
}
diff --git a/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/config/AbstractIntegrationTest.java b/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/config/AbstractIntegrationTest.java
index 81ed342..d462194 100644
--- a/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/config/AbstractIntegrationTest.java
+++ b/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/config/AbstractIntegrationTest.java
@@ -2,22 +2,9 @@
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.learning.ai.llmragwithspringai.TestLlmRagWithSpringAiApplication;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.web.servlet.MockMvc;
@SpringBootTest(
webEnvironment = RANDOM_PORT,
- classes = {TestLlmRagWithSpringAiApplication.class})
-@AutoConfigureMockMvc
-public abstract class AbstractIntegrationTest {
-
- @Autowired
- protected MockMvc mockMvc;
-
- @Autowired
- protected ObjectMapper objectMapper;
-}
+ classes = {ContainersConfig.class})
+public abstract class AbstractIntegrationTest {}
diff --git a/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/config/ContainersConfig.java b/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/config/ContainersConfig.java
new file mode 100644
index 0000000..19faef0
--- /dev/null
+++ b/rag/rag-springai-openai-llm/src/test/java/com/learning/ai/llmragwithspringai/config/ContainersConfig.java
@@ -0,0 +1,17 @@
+package com.learning.ai.llmragwithspringai.config;
+
+import org.springframework.boot.test.context.TestConfiguration;
+import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
+import org.springframework.context.annotation.Bean;
+import org.testcontainers.containers.PostgreSQLContainer;
+import org.testcontainers.utility.DockerImageName;
+
+@TestConfiguration(proxyBeanMethods = false)
+public class ContainersConfig {
+
+ @Bean
+ @ServiceConnection
+ PostgreSQLContainer> pgvectorContainer() {
+ return new PostgreSQLContainer<>(DockerImageName.parse("pgvector/pgvector:pg17"));
+ }
+}