Improve detection of whether an Outbox entity mapping is required

Description

See

 

We’re currently testing whether the configuration property for “automatic_indexing.strategy” is set to some magic string. But that’s wrong:

  • Users could legitimately use builtin:themagicstring as the value of that configuration property.

  • In extreme scenarios, users could provide their own bean reference that would ultimately return the automatic indexing strategy indirectly.

We should try to improve the current implementation.

One way is to just retrieve the automatic indexing strategy (the bean holder) and test its type using instance of. That’s a bit dirty, but it will work most of the time.

As an alternative to instanceof, we could have a proper SPI. For example a contribute(StandardServiceRegistryBuilder serviceRegistryBuilder) method that would allow the strategy to contribute services, which could then be retrieved from the AdditionalJaxbMappingProducer to decide whether an additional mapping is required or not. That would require moving the instantiation of the automatic indexing strategy to a much earlier phase, however; possibly before the Hibernate Search integrator is called.

Environment

None

Assignee

Unassigned

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Priority

Major