Skip to content

getting a single extension fails when multiple extensions exist even using Primary #38

@claymccoy

Description

@claymccoy

I've got a more representative demo Spring PF4J demo here:
https://github.com/claymccoy/Pf4jSpringGreetingDemo

It works fine, even when I uncomment the single greeting endpoint.
https://github.com/claymccoy/Pf4jSpringGreetingDemo/blob/master/src/main/java/org/pf4j/demo/GreetingsController.java#L25

But with the single greeting endpoint uncommented, if I add more greeting extensions via plugins it fails. That is not surprising. However, I would expect it to work if one of the extensions is marked with the Primary Spring annotation. But I still get this:

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

Description:

Field greeting in org.pf4j.demo.GreetingsController required a single bean, but 2 were found:
	- org.pf4j.demo.WhazzupGreeting: a programmatically registered singleton	- com.claymccoy.pf4jdemo.bjj.BjjGreeting: a programmatically registered singleton

Action:
Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

> Task :bootRun FAILED

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions