Support referencing of non-inline MetadataFilters

Description

I would like to figure out a way to support a bean reference to a MetadataFilter defined separately from a MetadataProvider, to enable more separation of configuration from curated vs. non-curated sources.

Environment

None

duplicates

Activity

Show:

Scott Cantor October 22, 2019 at 4:06 PM

Implemented, docs added.

Scott Cantor October 18, 2019 at 6:54 PM

This is fighting against Spring's DI model, so it's not clean. I think the way this works is that we would need to build a Spring-aware MetadataFilter that holds other Filters and the mappings to which MetadataProviders they apply to.

That filter would be injected into the filter chains built by the AbstractMetadataResolverParser base class.

In turn, we would have to utilize the new MetadataFilterContext mechanism and attach data identifying the MetadataResolver "id" being filtered, which then provides the Spring-aware Filter with the knowledge it needs to identify which MetadataFilters apply to that request.

Scott Cantor October 18, 2019 at 6:10 PM

Initial research. I noted a comment on the Chaining provider type that incorrectly claims filters defined there would override filters defined inside the chained providers, which was not true; filters were being processed but injected into the Chaining provider triggering a runtime error. I fixed this for now and just ignored the filters, but probably should add a warning.

I think what we want to start with is a new top level element to parse that would register any embedded MetadataFilters as beans in the context (i.e. a parser based on BeanDefinition and not SingleBeanDefinition). That will get them defined.

The naive thing to do would be the usual metadataFilterRef approach on the providers, but that kind of gets the problem backwards. I think what we really want is to figure out a way to have the filters specify in themselves what provider(s) to attach to. But I don't know how to pull that off yet.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Components

Fix versions

Created October 18, 2019 at 6:06 PM
Updated March 11, 2020 at 2:10 PM
Resolved October 22, 2019 at 4:06 PM