I thought about using getBeanNamesForType until I realized the type check(s) need to happen on multiple beans of different types (Regions, DiskStores, perhaps others), hence the following comments and associated code snippet...

  // TODO what else depends on a PDX Disk Store besides Regions?
  if (isPersistentRegion(beanDefinition) || isDiskStore(beanDefinition)) {
  ...

It is a rather interesting problem in that, if the Region is defined before the Disk Store the Region is using for persistence, where the data may potential contain Keys that are PDX types, all is well since the depends-on attribute of the Region references the PDX Disk Store.  However, if the user were to declare/define the Disk Store used by the Region for persistence before the Region, Spring will parse that data Disk Store bean definition first and create an instance before the Region that depends on it thereby running into the same problem.

I worried that there maybe other uses of the PDX Disk Store, like Async Event Queues that persist data which may need to be considered also.  However, the Async Event Queue case is covered since I am adding the dependency on all Disk Store beans regardless of whether they contain PDX type data or not.

Essentially, I just want to make sure the PDX Disk Store is created after the Cache, or close to it, before any Region or Disk Store is created.  Probably having all data Disk Stores depend on the PDX Disk Store would have been sufficient since both Regions and Async Event Queues create bean reference to their data Disk Store.  I could maybe change this to just include Disk Stores.  However, anything that needs and references a Disk Store better had created a bean reference to the Disk Store to ensure proper order in bean creation.

Thoughts?