Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Dependency injection from library #782

Closed
furkansavsatli opened this issue May 17, 2021 · 4 comments
Closed

Dependency injection from library #782

furkansavsatli opened this issue May 17, 2021 · 4 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@furkansavsatli
Copy link

furkansavsatli commented May 17, 2021

I am using spring-native 0.9.2 and can run my services by removing bean injections. I also put 2 projects in the same directory so that the @componentscan annotation is not needed. If I add @autowire annotations back, I get an error while inject the service beans defined in the libraries into the project I will use.

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'config': Unsatisfied dependency expressed through field 'sampleService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.sample.service.SampleService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired}

Other than that, ResourceUtils in the library may not be able to access the library resource. Likewise, if I use it only in the library, I get an error.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 17, 2021
@sdeleuze
Copy link
Contributor

Please provide a repro project.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label May 17, 2021
@furkansavsatli
Copy link
Author

furkansavsatli commented May 17, 2021

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 17, 2021
@sdeleuze sdeleuze self-assigned this May 17, 2021
@sdeleuze sdeleuze changed the title Dependecy injection from library Dependency injection from library May 18, 2021
@sdeleuze sdeleuze added this to the 0.10.0 milestone May 19, 2021
@sdeleuze sdeleuze added type: bug A general bug and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged or decided on labels May 19, 2021
sdeleuze added a commit to sdeleuze/spring-native that referenced this issue May 31, 2021
A better but more involved fix would be AOT @componentscan processing,
see spring-atticgh-801 related issue.

Fixes spring-atticgh-782
sdeleuze added a commit that referenced this issue Jun 1, 2021
@erikknaake
Copy link

This seems to be the exact issue I am having, is there a way to get access to an early release, or compile it myself?

@sdeleuze
Copy link
Contributor

0.10.0 has been pleased, otherwise yes you can use snapshots from https://repo.spring.io/snapshot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A general bug
Development

No branches or pull requests

4 participants