SGF-697 - Allow basePackages to be configured using a property when creating Entity-defined Regions.

This commit is contained in:
John Blum
2017-11-26 23:30:08 -08:00
parent a5915f1959
commit e720d71ef5
4 changed files with 110 additions and 4 deletions

View File

@@ -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()
*/

View File

@@ -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))

View File

@@ -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);