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

ObjectFactory<List> with specified constructor args occurs error #29110

Closed
qrqhuang opened this issue Sep 8, 2022 · 5 comments
Closed

ObjectFactory<List> with specified constructor args occurs error #29110

qrqhuang opened this issue Sep 8, 2022 · 5 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid

Comments

@qrqhuang
Copy link

qrqhuang commented Sep 8, 2022

ObjectProvider support a method to get bean with specified args. (#18529)

But I have a collection beans to autowired, Use ObjectProvider<List<T>>, but now it looks like the args not effect, and throw
No qualifying bean for constructor.

spring version: 4.3.25.RELEASE

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 8, 2022
@snicoll
Copy link
Member

snicoll commented Sep 8, 2022

@qrqhuang Unfortunately, Spring Boot 4.3.x is out of OSS support. If you manage to reproduce the problem with a supported version, please share a small sample we can run ourselves and we can have a look.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Sep 8, 2022
@qrqhuang
Copy link
Author

qrqhuang commented Sep 8, 2022

@snicoll Use spring 5.3.22, still the same error.

model

@Data
public class OrderContext {

    private String orderNo;
}

component

@Component
@Scope(value = BeanDefinition.SCOPE_PROTOTYPE)
public class OrderTask {

    private OrderContext orderContext;

    public OrderTask(OrderContext orderContext) {
        this.orderContext = orderContext;
    }
}

test case. should not throw error

    @Autowired
    private ObjectProvider<List<OrderTask>> objectProviders;

    @Test
    void testProviders() {
        OrderContext orderContext = new OrderContext();
        orderContext.setOrderNo("222");
        objectProviders.getObject(orderContext);
    }

@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 Sep 8, 2022
@snicoll
Copy link
Member

snicoll commented Sep 8, 2022

I don't understand what you're trying to achieve with a List on ObjectProvider. ObjectProvider should be used against the target bean and handle the list use case using stream. What do you expect to happen if this worked and there are multiple OrderTask in the context?

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Sep 8, 2022
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Sep 15, 2022
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 22, 2022
@sbrannen sbrannen added status: invalid An issue that we don't feel is valid in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants