Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The interface decorated with "@AiService" cannot be scanned by "AiServicesAutoConfig" when running the SpringBoot Jar package. #1030

Open
clear2x opened this issue Apr 28, 2024 · 3 comments
Labels
bug Something isn't working P3 Medium priority

Comments

@clear2x
Copy link

clear2x commented Apr 28, 2024

Describe the bug
The Spring Boot project packaged as a JAR file cannot scan the AiService annotated with @AiService.

Log and Stack trace

console output:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in co.xx.XXXService required a bean of type 'co.xx.XXXAgent' that could not be found.

This is a screenshot of the debug output :
image

The specific issue arises here:
image

To Reproduce

  1. create a springboot project , use langchain4j :
<dependency>
     <groupId>dev.langchain4j</groupId>
     <artifactId>langchain4j-spring-boot-starter</artifactId>
     <version>0.30.0</version>
</dependency>
<dependency>
     <groupId>dev.langchain4j</groupId>
     <artifactId>langchain4j-open-ai-spring-boot-starter</artifactId>
      <version>0.30.0</version>
</dependency>
  1. Create an AiService and annotate it with @AiService.
  2. mvn package & run XXX.jar

Expected behavior

Please complete the following information:

  • LangChain4j version: 0.30.0
  • LLM(s) used: OpenAI
  • Java version: Java8
  • Spring Boot version (if applicable): 2.7.18

Additional context

@clear2x clear2x added the bug Something isn't working label Apr 28, 2024
@langchain4j
Copy link
Owner

Hi @clear2x thanks a lot for reporting!
Since you've debugged it already, do you see a way to fix it?
Thanks

@clear2x
Copy link
Author

clear2x commented May 9, 2024

I attempted to fix this. Here's the PR : langchain4j/langchain4j-spring#20

@langchain4j
Copy link
Owner

@clear2x thank you a lot! I will check it asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3 Medium priority
Projects
None yet
Development

No branches or pull requests

2 participants