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

fix #1827 ComponentScan with SPEL will not parse #48

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

qing-wq
Copy link
Contributor

@qing-wq qing-wq commented Oct 9, 2024

Fixes langchain4j/langchain4j#1827

fix ComponentScan basePackages with placeholders will not be parsed.

Changes Made:

  • Support for parsing @componentscan with placeholders
  • Simplify the getBasePackages()

@langchain4j
Copy link
Collaborator

@qing-wq thanks a lot! Could you please add a test that tests the situation in langchain4j/langchain4j#1827 (comment)? 🙏

@qing-wq
Copy link
Contributor Author

qing-wq commented Oct 10, 2024

I added new test cases and removed the redundant tests about SpringBootApplication, which was not required

@langchain4j
Copy link
Collaborator

@qing-wq thanks! Why removing existing tests though?

@qing-wq
Copy link
Contributor Author

qing-wq commented Oct 10, 2024

I've learned that @SpringBootApplication is essentially an alias for @ComponentScan, so I don't think we need to test it alone, just@ComponentScan

@AliasFor(annotation = ComponentScan.class, attribute = "basePackages")
String[] scanBasePackages() default {};

@AliasFor(annotation = ComponentScan.class, attribute = "basePackageClasses")
Class<?>[] scanBasePackageClasses() default {};

@langchain4j
Copy link
Collaborator

@qing-wq I would still keep it, assuming there is no harm and test is fast

@qing-wq
Copy link
Contributor Author

qing-wq commented Oct 11, 2024

I understand, and I canceled my modification

@langchain4j
Copy link
Collaborator

@qing-wq please check the tests, they all failed.

@qing-wq
Copy link
Contributor Author

qing-wq commented Oct 26, 2024

sorry, there are some errors in my test code, but now I have fixed it.

Copy link
Collaborator

@langchain4j langchain4j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qing-wq thank you!

…service/spring/mode/automatic/differentPackage/package1/DifferentPackageAiServiceIT.java
@langchain4j langchain4j merged commit 3fbf707 into langchain4j:main Oct 28, 2024
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] For langchain4j-spring-boot-starter, ComponentScan with SPEL will not parse.
3 participants