No qualifying bean of type 'io.jmix.flowui.model.InstanceLoader<...>' available

Hi there,

i am working on implementing the audit log example, using jmix 2.1.2. Instead of an entity “Order” I have an entity “Person”.

I modified the controller (PersonDetailView.java) as described:



 @Autowired
    private InstanceLoader<Person> personDl;

    @Autowired
    private CollectionLoader<EntityLogItem> entityLogPersonsDl;
   @Subscribe
    public void onBeforeShow(BeforeShowEvent event) {
        personDl.load();
    }

    @Subscribe(id = "personDc", target = Target.DATA_CONTAINER)
    public void onPersonDcItemChange(InstanceContainer.ItemChangeEvent<Person> event) {
        entityLogPersonsDl.setParameter("person", event.getItem().getId());
        entityLogPersonsDl.load();
    }

when running the application I get an org.springframework.beans.factory.NoSuchBeanDefinitionException

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.jmix.flowui.model.InstanceLoader<...entity.Person>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

What am I doing wrong?

Hi Uwe,

In Jmix 2.x, the view components are injected using the @ViewComponent annotation instead of @Autowired. So try to change it here:

@ViewComponent
private InstanceLoader<Person> personDl;

@ViewComponent
private CollectionLoader<EntityLogItem> entityLogPersonsDl;