Conversation
…we can run the app only with the maven profiles only)
There was a problem hiding this comment.
Pull request overview
This PR aligns Maven profile selection with Spring profile activation for each supported AI provider, aiming to let users run the app by choosing only a Maven profile.
Changes:
- Updated
application.ymlto use per-providerspring.config.activate.on-profileblocks (openai, vertex-ai, ollama, anthropic) and added agithub-copilotprofile. - Updated
pom.xmlMaven profiles to setspring-boot.run.profilesfor each provider and added agithub-copilotMaven profile. - Updated
README.mdprovider/config documentation and run commands to use-P<profile>.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/main/resources/application.yml |
Adds per-Spring-profile AI provider configuration blocks and a shared arena base URL. |
pom.xml |
Sets Spring runtime profiles from Maven profiles and introduces a new github-copilot provider profile. |
README.md |
Updates provider matrix and run instructions to reflect Maven-profile-driven execution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -74,9 +74,9 @@ | |||
| <profiles> | |||
| <profile> | |||
| <id>openai</id> | |||
There was a problem hiding this comment.
With no Spring AI dependency declared outside Maven profiles, removing activeByDefault from the openai profile means a default mvn test/IDE import will fail to compile (main sources import org.springframework.ai.*). Consider restoring activeByDefault for openai (and keep spring-boot.run.profiles), or add a non-profile Spring AI core dependency so builds don’t require -P....
| <id>openai</id> | |
| <id>openai</id> | |
| <activation> | |
| <activeByDefault>true</activeByDefault> | |
| </activation> |
| openai: | ||
| api-key: ${OPENAI_API_KEY} | ||
| api-key: ${OPENAI_API_KEY:your-openai-key-here} | ||
| chat: | ||
| options: | ||
| model: gpt-4o-mini |
There was a problem hiding this comment.
spring.ai.*.api-key defaults to a placeholder value when the env var is missing, which can mask misconfiguration (app starts but auth fails later). Prefer omitting defaults for secret credentials and failing fast (or add explicit validation).
| anthropic: | ||
| api-key: ${ANTHROPIC_API_KEY:your-anthropic-key-here} | ||
| chat: | ||
| options: | ||
| model: claude-3-5-haiku-20241022 |
There was a problem hiding this comment.
spring.ai.*.api-key defaults to a placeholder value when the env var is missing, which can mask misconfiguration (app starts but auth fails later). Prefer omitting defaults for secret credentials and failing fast (or add explicit validation).
| openai: | ||
| api-key: ${GITHUB_TOKEN:your-github-token-here} | ||
| base-url: https://models.inference.ai.azure.com | ||
| chat: | ||
| completions-path: /chat/completions |
There was a problem hiding this comment.
spring.ai.*.api-key defaults to a placeholder value when the env var is missing, which can mask misconfiguration (app starts but auth fails later). Prefer omitting defaults for secret credentials and failing fast (or add explicit validation).
| Use the Maven wrapper to run the project with the desired profile: | ||
|
|
||
| ```bash | ||
| # Run with OpenAI (default profile) | ||
| ./mvnw spring-boot:run | ||
|
|
||
| # Or run with a specific profile | ||
| ./mvnw spring-boot:run -Popenai | ||
| ./mvnw spring-boot:run -Pvertex-ai |
There was a problem hiding this comment.
Because Spring AI dependencies are only included via Maven profiles, running Maven goals without -P... (e.g., ./mvnw clean test as shown earlier in the README) will fail to compile. Either restore a default profile (e.g., OpenAI) or update the setup docs around these run commands to note that users must pass a provider profile for builds/tests too.
There was a problem hiding this comment.
@copilot code review[agent] I think you're wrong , I executed the mvn clean test goal and still it is working...
Now we can run the app only with the maven profiles only ;-)