Programmatically adding FilterDefinition


Is it possible in version 6 to add FilterDefinition without @FilrterDef annotation?

I tried MetadataContributor, but it is not working: not seen in the list of classLoaderService

import org.hibernate.boot.spi.InFlightMetadataCollector;
import org.hibernate.boot.spi.MetadataContributor;
import org.jboss.jandex.IndexView;
import org.kohsuke.MetaInfServices;
import org.springframework.stereotype.Component;

public class AddFilterContributor implements MetadataContributor {
    public void contribute(InFlightMetadataCollector inFlightMetadataCollector, IndexView indexView) {
               inFlightMetadataCollector.addFilterDefinition(new FilterDefinition(...));

Also. Not sure it is important: AddFilterContributor is still not created at the moment of calling MetadataBuildingProcess#complete


Also tried to add file
with fully qualified name

the same result :frowning:

pls help me

My bad. it is working!

  1. @Component is not necessary
  2. org.hibernate.boot.spi.MetadataContributor file in resources is mondatory