Open Carm2501 opened 4 years ago
post your CampaignListProducer
`package de.dpunkt.myaktion.data;
import de.dpunkt.myaktion.model.Campaign; import de.dpunkt.myaktion.services.CampaignService; import de.dpunkt.myaktion.util.Events.Added; import de.dpunkt.myaktion.util.Events.Deleted;
import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Observes; import javax.enterprise.inject.Produces; import javax.inject.Inject; import javax.inject.Named; import java.io.Serializable; import java.util.List;
@SessionScoped public class CampaignListProducer implements Serializable {
private static final long serialVersionUID = -182866064791747156L;
private List<Campaign> campaigns;
@Inject
private CampaignService campaignService;
@PostConstruct
public void init() {
campaigns = campaignService.getAllCampaigns();
}
@Produces
@Named
public List<Campaign> getCampaigns() {
return campaigns;
}
public void onCampaignAdded(@Observes @Added Campaign campaign) {
getCampaigns().add(campaign);
}
public void onCampaignDeleted(@Observes @Deleted Campaign campaign) {
getCampaigns().remove(campaign);
}
} `
looks correct actually i think you need to debug by yourself in QuarkusCdiELResolver and find out why Quarkus thinks its a Dependent
Ah - your @Produces doesnt have a scope
Thank you, that fixed the problem!
Hi, I'm trying to migrate my application "my-aktion" from wildfly to quarkus. I know that quarkus works differently with CDIs, so I tried to update the code. I also added the jsf extension. When my application is deployed and I'm trying to access the main page http://localhost:8080/listCampaigns.jsf page it says "not found". When trying to access the same page in .xhtml is says the following error:
I had one @Dependent Annoation in the Code and I replaced it with a @SessionScoped but the error is still there. Regarding the official Quarkus CDI page (https://quarkus.io/guides/cdi-reference) Beans are automatically declared as @Dependent, when there is no specific annotation. But all my beans have a scope annoation.
As I'm new to all of this, can somebody please help? @tandraschko?
My code: https://github.com/Carm2501/Quarkus