Sitemap
CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

AI driven Activity monitoring — Docker AI models & Spring framework

3 min readSep 21, 2025

--

Press enter or click to view image in full size
image from FreePic
Press enter or click to view image in full size
dashboard AI generated message, summarizing recent system activity logs, by integrating with Docker AI model gemma3

AI-driven Audit Monitoring leverages the power of artificial intelligence to provide continuous, intelligent oversight of business processes and system activities. By integrating AI models packaged in Docker containers with a Spring MVC–based Java application, organizations can achieve scalable, real-time monitoring without disrupting existing infrastructures.

Press enter or click to view image in full size

The Spring MVC framework ensures a modular and maintainable backend that efficiently routes and manages audit data, while Docker enables seamless deployment and scaling of AI models across environments.

These AI models can automatically detect anomalies, flag suspicious transactions, and generate predictive insights, reducing manual audit workloads and improving compliance accuracy. This architecture not only enhances transparency and reliability in audit processes but also offers a flexible foundation to incorporate future AI advancements with minimal operational overhead.

Sample System Activity Logs

Press enter or click to view image in full size

How to set up Docker Desktop and pull the Gemma3 model:

Install Docker Desktop

  • Go to Docker Desktop download page.
  • Download the installer for your OS (Windows or macOS).
  • Run the installer and follow the setup wizard.
  • After installation, open Docker Desktop and ensure the Docker Engine is running.

Pull and Run Gemma3 Model with Docker

Use AI Models inside Docker

Press enter or click to view image in full size
Press enter or click to view image in full size

Code snippet from Spring MVC dashboardController

@Slf4j
@Component
public class AIUtil {

private ObjectMapper mapper = new ObjectMapper();

private final WebClient webClient;

public AIUtil() {
this.webClient = WebClient.builder()
.baseUrl("http://localhost:12434")
.build();
}

public String callModelRunner(ChatRequestDTO chatRequestDTO) {
try {
var response = webClient.post()
.uri("/engines/llama.cpp/v1/chat/completions")
.header("Content-Type", "application/json")
.bodyValue(mapper.writeValueAsString(chatRequestDTO))
.retrieve()
.bodyToMono(ChatCompletionResponseDTO.class)
.onErrorResume(e -> {
e.printStackTrace();
return Mono.empty();
})
.block();
log.info("AI Response: " + response.getChoices().get(0).getMessage().getContent());

return response.getChoices().get(0).getMessage().getContent();

} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
  AIUtil aiUtil = new AIUtil();
var request = ChatRequestDTO.builder()
.model("ai/gemma3")
.messages(new ArrayList<>())
.build();
Message m = new Message();
m.setRole("user");
m.setContent("You are an AI assistant that helps users to understand the latest activities in their system. "
+ "Based on the following activity summaries, provide a concise and friendly welcome message for the dashboard, "
+ "highlighting key actions and encouraging further engagement. "
+ "Make it engaging and relevant to the user's recent activities. "
+ "Also suggest one or two actions the user might want to take next based on these activities. "
+ "Kepp an eye on security-related activities and mention them if relevant. "
+ "Here are the activity summaries: " + activitySummaries.toString());
request.getMessages().add(m);
String response = aiUtil.callModelRunner(request);
if (response != null && response.length() > 0) {
model.addAttribute("message",
response.replace("\\", "\\\\") // backslash
.replace("\"", "\\\"") // double quote
.replace("\r", "\\r") // carriage return
.replace("\n", "\\n"));
}

application.properties

spring.ai.chat.client.enabled=true
spring.ai.openai.api-key=ignored
spring.ai.openai.base-url=http://localhost:12434/engines
spring.ai.openai.chat.options.model=ai/gemma3

You can download full Spring MVC code from below link

https://github.com/patroklos83/SpringMVC

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

No responses yet