This projects serves as the Spring Boot 3 starter project for the ollama-java-client
library.
This starter simplifies the setup process, allowing the library to be imported and automatically configured within a Spring Boot project.
- Write an Auto Configuration class providing the required bean definitions
@AutoConfiguration
public class OllamaJavaClientAutoconfiguration {
@ConditionalOnMissingBean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConfigurationProperties(prefix = "ollama")
@Bean
public OllamaProperties ollamaProperties() {
return new OllamaProperties();
}
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public OllamaService ollamaService(OllamaProperties ollamaProperties) {
return OllamaServiceFactory.create(ollamaProperties);
}
}
- A file
resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
that instructs Spring Boot about the Configuration classes to scan.
es.omarall.ollama.OllamaJavaClientAutoconfiguration
Check the spring-boot-ollama-sample project for a sample usage of the starter.