spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/index.html
Apache License 2.0
3.21k stars 812 forks source link

Spring AI cannot be integrated with spring-boot-starter-Webflux and spring-boot-starter-security #1085

Closed ExxXyz closed 1 month ago

ExxXyz commented 3 months ago

Because Spring AI relies on spring-boot-starter-web, @EnableWebFlux conflicts with @EnableWebMvc. Is there any good way to solve this problem?

nithin9700 commented 3 months ago

you can resolve the conflict between @EnableWebFlux and @EnableWebMvc by choosing one over the other based on your application requirements. Here are some options to help you navigate this situation: If you are building a reactive application, you should use @EnableWebFlux. Make sure to exclude any dependencies that rely on spring-boot-starter-web and its servlet-based stack. if you are building a non reactive(standard servlet-based), you should use @EnableWebMvc. In this case, remove the spring-boot-starter-webflux dependency and use spring-boot-starter-web.

if you want to use both reactive and non reactive endpoints in the application (which not recommend). You can create conditional configuration based on specific profiles.

csterwa commented 1 month ago

Hello @ExxXyz - hopefully the response from @nithin9700 answered your question. Please let us know if you would like to reopen for any particular follow ups. Thank you.