SGF-697 - Allow basePackages to be configured using a property when creating Entity-defined Regions.
This commit is contained in:
@@ -91,6 +91,8 @@ public @interface EnableEntityDefinedRegions {
|
||||
*
|
||||
* Use {@link #basePackageClasses()} for a type-safe alternative to String-based package names.
|
||||
*
|
||||
* Use the {@literal spring.data.gemfire.entities.base-packages} property in {@literal application.properties}.
|
||||
*
|
||||
* @return a {@link String} array specifying the packages to search for application persistent entities.
|
||||
* @see #value()
|
||||
*/
|
||||
|
||||
@@ -188,10 +188,11 @@ public class EntityDefinedRegionsConfiguration extends AbstractAnnotationConfigS
|
||||
|
||||
Set<String> resolvedBasePackages = new HashSet<>();
|
||||
|
||||
Collections.addAll(resolvedBasePackages, nullSafeArray(defaultIfEmpty(
|
||||
enableEntityDefinedRegionAttributes.getStringArray("basePackages"),
|
||||
enableEntityDefinedRegionAttributes.getStringArray("value")),
|
||||
String.class));
|
||||
Collections.addAll(resolvedBasePackages, resolveProperty(entitiesProperty("base-packages"),
|
||||
String[].class, nullSafeArray(defaultIfEmpty(
|
||||
enableEntityDefinedRegionAttributes.getStringArray("basePackages"),
|
||||
enableEntityDefinedRegionAttributes.getStringArray("value")),
|
||||
String.class)));
|
||||
|
||||
stream(nullSafeArray(enableEntityDefinedRegionAttributes.getClassArray(
|
||||
"basePackageClasses"), Class.class))
|
||||
|
||||
@@ -722,6 +722,11 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
return String.format("%1$s%2$s.%3$s", propertyName("disk.store."), name, propertyNameSuffix);
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected String entitiesProperty(String propertyNameSuffix) {
|
||||
return String.format("%1$s%2$s", propertyName("entities."), propertyNameSuffix);
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected String locatorProperty(String propertyNameSuffix) {
|
||||
return String.format("%1$s%2$s", propertyName("locator."), propertyNameSuffix);
|
||||
|
||||
Reference in New Issue
Block a user