diff --git a/spring-configuration-aggregator-maven-plugin/README.md b/spring-configuration-aggregator-maven-plugin/README.md index e648135..ea5e288 100644 --- a/spring-configuration-aggregator-maven-plugin/README.md +++ b/spring-configuration-aggregator-maven-plugin/README.md @@ -28,8 +28,9 @@ All found files will then be merged into a single file, with following attribute - the `name` of the configuration property used - the `type` of the attribute - the `description` taken from the JavaDoc defined on the attribute (if any) -- the `defaultValue` specified in the annotation (if any) -- the `sourceTypes` the list of references to this property: +- the `defaultValue` specified in the annotation, or in the properties file (if any) +- the `profiles` maps all defined values per Spring profile +- the `sourceTypes` lists all references to this property: - the `groupId`, the group id of the dependency - the `artifactId`, the artifact id of the dependency - the `sourceType`, the class referencing this property @@ -68,6 +69,7 @@ The plugin can be configured through following properties: | `includeDependencies` | `List` | Specifies a list of dependencies to include for aggregation. | | `excludeDependencies` | `List` | Specifies a list of dependencies to exclude from aggregation. | | `propertiesFiles` | `List` | Specifies a list of properties files to parse for default values. | +| `profiles` | `String` | Comma separated list of Spring profiles to include values for. | | `outputReports` | `List` | Specifies a list of reports to generate. | The `DependencyMatcher` type is defined with following properties: diff --git a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/AggregatorMojo.java b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/AggregatorMojo.java index dbc914f..296d231 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/AggregatorMojo.java +++ b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/AggregatorMojo.java @@ -12,8 +12,8 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.util.ArrayList; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * Aggregates all Spring Configuration Properties metadata into a single file. @@ -27,6 +27,13 @@ public class AggregatorMojo extends AbstractPluginMojo { @Parameter() private List propertiesFiles; + /** + * Comma separated list of spring profiles to include for reading values ('*' for all, '-' for none). + * Default value: '*'. + */ + @Parameter() + private String profiles; + @Override public void execute() throws MojoExecutionException, MojoFailureException { if (this.skip) { @@ -52,7 +59,10 @@ public void execute() throws MojoExecutionException, MojoFailureException { ); // Retrieving properties - final List properties = aggregationService.aggregate(this.getPropertiesFiles()); + final List properties = aggregationService.aggregate( + this.getPropertiesFiles(), + this.getProfiles() + ); // Saving properties aggregationService.save(properties); @@ -79,4 +89,20 @@ private List getPropertiesFiles() { return files; } + private Set getProfiles() { + // Default value: all found profiles (null) + if (this.profiles == null || this.profiles.equals("*")) { + return null; + } + + // No profile included: empty set + if (this.profiles.equals("-")) { + return Collections.emptySet(); + } + + // Split and trim values + return Arrays.stream(this.profiles.split(",")) + .map(String::trim) + .collect(Collectors.toSet()); + } } diff --git a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/AggregationBuilder.java b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/AggregationBuilder.java index cc98706..fde36d3 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/AggregationBuilder.java +++ b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/AggregationBuilder.java @@ -15,12 +15,12 @@ public class AggregationBuilder { private final Map, List> artifactProperties; - private final Properties defaultValues; + private final Map defaultValues; public AggregationBuilder(final Log log) { this.log = log; this.artifactProperties = new HashMap<>(); - this.defaultValues = new Properties(); + this.defaultValues = new HashMap<>(); } public AggregationBuilder add(final List metadata, final String groupId, final String artifactId) { @@ -38,8 +38,11 @@ public AggregationBuilder add(final List metadata, final Strin return this; } - public AggregationBuilder put(final Properties defaultValues) { - this.defaultValues.putAll(defaultValues); + public AggregationBuilder put(final String profile, final Properties properties) { + if (!this.defaultValues.containsKey(profile)) { + this.defaultValues.put(profile, new Properties()); + } + this.defaultValues.get(profile).putAll(properties); return this; } @@ -81,8 +84,22 @@ private AggregatedPropertyMetadata create(final PropertyMetadata property, final aggregate.setName(property.getName()); aggregate.setDefaultValue(property.getDefaultValue()); // If a default value is defined, it overrides the already defined one - if (this.defaultValues.containsKey(property.getName())) { - aggregate.setDefaultValue(this.defaultValues.getProperty(property.getName())); + for (final Map.Entry entry : this.defaultValues.entrySet()) { + final String profile = entry.getKey(); + final Properties profileProperties = entry.getValue(); + this.log.debug("Found " + profileProperties.size() + " values for profile " + profile); + + if (!profileProperties.containsKey(property.getName())) { + continue; + } + if (DefaultAggregationService.DEFAULT_PROFILE.equals(profile)) { + aggregate.setDefaultValue(profileProperties.getProperty(property.getName())); + continue; + } + if (aggregate.getProfiles() == null) { + aggregate.setProfiles(new HashMap<>()); + } + aggregate.getProfiles().put(profile, profileProperties.getProperty(property.getName())); } aggregate.setType(property.getType()); aggregate.setDescription(property.getDescription()); diff --git a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/DefaultAggregationService.java b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/DefaultAggregationService.java index 973fce8..d055f76 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/DefaultAggregationService.java +++ b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/DefaultAggregationService.java @@ -8,16 +8,18 @@ import com.github.egoettelmann.spring.configuration.extensions.aggregator.maven.core.exceptions.OperationFailedException; import com.github.egoettelmann.spring.configuration.extensions.aggregator.maven.core.model.AggregatedPropertyMetadata; import com.github.egoettelmann.spring.configuration.extensions.aggregator.maven.core.model.PropertyMetadata; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.filefilter.WildcardFileFilter; +import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.eclipse.aether.artifact.Artifact; +import java.io.File; +import java.io.FileFilter; import java.io.IOException; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; +import java.util.*; public class DefaultAggregationService implements AggregationService { @@ -28,6 +30,8 @@ public class DefaultAggregationService implements AggregationService { private static final String AGGREGATED_FILE = "/META-INF/aggregated-spring-configuration-metadata.json"; + public final static String DEFAULT_PROFILE = "default"; + private final Log log; private final RepositoryService repositoryService; @@ -58,7 +62,7 @@ public DefaultAggregationService( } @Override - public List aggregate(final List propertiesFiles) { + public List aggregate(final List propertiesFiles, final Set profiles) { final AggregationBuilder builder = new AggregationBuilder(this.log); // Resolving from current project @@ -79,12 +83,11 @@ public List aggregate(final List pro // Adding default values if (propertiesFiles != null) { for (final PropertiesFile propertiesFile : propertiesFiles) { - try { - final Properties properties = this.propertiesValueReader.read("file:///" + propertiesFile.getPath()); - builder.put(properties); - } catch (final MetadataFileNotFoundException e) { - this.log.warn("No properties found in " + propertiesFile.getPath()); - this.log.debug(e); + final Map properties = this.loadPropertiesValues(propertiesFile.getPath()); + for (final Map.Entry entry : properties.entrySet()) { + if (profiles == null || profiles.contains(entry.getKey())) { + builder.put(entry.getKey(), entry.getValue()); + } } } } @@ -140,4 +143,66 @@ private List readPropertiesFromPath(final String path) { return properties; } + private Map loadPropertiesValues(final String path) { + final Map properties = new HashMap<>(); + properties.put(DEFAULT_PROFILE, new Properties()); + + final File propertiesFile = new File(path); + try { + final List propertiesList = this.propertiesValueReader.read("file:///" + path); + for (final Properties values : propertiesList) { + final String profiles = (String) values.getOrDefault("spring.profiles", values.get("spring.config.activate.on-profile")); + if (StringUtils.isBlank(profiles)) { + properties.get(DEFAULT_PROFILE).putAll(values); + continue; + } + for (final String profile : profiles.split(",")) { + properties.putIfAbsent(profile.trim(), new Properties()); + properties.get(profile.trim()).putAll(values); + } + } + } catch (final MetadataFileNotFoundException e) { + this.log.warn("No properties found in " + path); + this.log.debug(e); + } + + final File folder = propertiesFile.getParentFile(); + final String baseName = FilenameUtils.getBaseName(propertiesFile.getName()); + final String extension = FilenameUtils.getExtension(propertiesFile.getName()); + final FileFilter fileFilter = new WildcardFileFilter(baseName + "-*." + extension); + this.log.debug("Looking up " + folder.getPath() + " for '" + baseName + "-*." + extension + "'"); + final File[] files = folder.listFiles(fileFilter); + if (files == null) { + return properties; + } + this.log.debug("Found " + files.length + " profile specific files to parse"); + + // Reading profile specific files + for (final File file : files) { + try { + final String profile = FilenameUtils.getBaseName(file.getName()).replace(baseName + "-", "").trim(); + this.log.debug("Parsing file " + file.getPath() + " for profile " + profile); + final List profilePropertiesList = this.propertiesValueReader.read("file:///" + file.getPath()); + for (final Properties values : profilePropertiesList) { + final String subProfiles = (String) values.getOrDefault("spring.profiles", values.get("spring.config.activate.on-profile")); + if (StringUtils.isBlank(subProfiles)) { + properties.putIfAbsent(profile, new Properties()); + properties.get(profile).putAll(values); + continue; + } + for (final String subProfile : subProfiles.split(",")) { + final String combinedProfile = profile + " & " + subProfile.trim(); + properties.putIfAbsent(combinedProfile, new Properties()); + properties.get(combinedProfile).putAll(values); + } + } + } catch (final Exception e) { + this.log.warn("Error reading profile specific file " + file.getPath()); + this.log.debug(e); + } + } + + return properties; + } + } diff --git a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/PropertiesValueReader.java b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/PropertiesValueReader.java index b4ec670..da39e76 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/PropertiesValueReader.java +++ b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/aggregation/PropertiesValueReader.java @@ -1,6 +1,7 @@ package com.github.egoettelmann.spring.configuration.extensions.aggregator.maven.components.aggregation; import com.github.egoettelmann.spring.configuration.extensions.aggregator.maven.core.exceptions.MetadataFileNotFoundException; +import org.apache.commons.io.FilenameUtils; import org.apache.maven.plugin.logging.Log; import org.yaml.snakeyaml.Yaml; @@ -18,7 +19,7 @@ public PropertiesValueReader(final Log log) { this.log = log; } - public Properties read(final String filePath) throws MetadataFileNotFoundException { + public List read(final String filePath) throws MetadataFileNotFoundException { // Parsing filePath as URL final URL propertiesUrl; try { @@ -26,16 +27,21 @@ public Properties read(final String filePath) throws MetadataFileNotFoundExcepti } catch (final MalformedURLException e) { throw new MetadataFileNotFoundException("Invalid file path " + filePath, e); } + final String extension = FilenameUtils.getExtension(propertiesUrl.getFile()); + this.log.debug("Reading file '" + filePath + "' with extension '" + extension + "'"); - final String extension = filePath.substring(filePath.lastIndexOf(".")); - if (".properties".equalsIgnoreCase(extension)) { - return this.readAsProperties(propertiesUrl); + // Parsing as properties + if ("properties".equalsIgnoreCase(extension)) { + return Collections.singletonList(this.readAsProperties(propertiesUrl)); } - if (".yml".equalsIgnoreCase(extension) || ".yaml".equalsIgnoreCase(extension)) { + + // Parsing as yaml + if ("yml".equalsIgnoreCase(extension) || "yaml".equalsIgnoreCase(extension)) { return this.readAsYaml(propertiesUrl); } - throw new MetadataFileNotFoundException("Unsupported file extension " + extension + " for " + propertiesUrl); + // Not a valid extension + throw new MetadataFileNotFoundException("Unsupported file extension " + extension + " for " + propertiesUrl.getFile()); } private Properties readAsProperties(final URL propertiesUrl) throws MetadataFileNotFoundException { @@ -45,33 +51,51 @@ private Properties readAsProperties(final URL propertiesUrl) throws MetadataFile // Parsing content final Properties properties = new Properties(); properties.load(fileContent); - this.log.debug("Found " + properties.size() + " property values in file " + propertiesUrl); + + // Logging all found properties for debug + if (this.log.isDebugEnabled()) { + this.log.debug("Found " + properties.size() + " property values in file " + propertiesUrl.getFile()); + for (final Map.Entry property : properties.entrySet()) { + this.log.debug("Found '" + property.getKey() + "=" + property.getValue() + "'"); + } + } // Returning parsed properties return properties; } catch (final IOException e) { - throw new MetadataFileNotFoundException("Failed reading " + propertiesUrl, e); + throw new MetadataFileNotFoundException("Failed reading " + propertiesUrl.getFile(), e); } } - private Properties readAsYaml(final URL propertiesUrl) throws MetadataFileNotFoundException { + private List readAsYaml(final URL propertiesUrl) throws MetadataFileNotFoundException { + final List propertiesList = new ArrayList<>(); + try (final InputStream fileContent = propertiesUrl.openStream()) { this.log.debug("Found property values file " + propertiesUrl.getFile()); - // Parsing content - final Properties properties = new Properties(); + // Parsing content: yaml file may contain multiple documents final Yaml yaml = new Yaml(); - final Map flattened = this.flatten(yaml.load(fileContent)); - properties.putAll(flattened); - this.log.debug("Found " + properties.size() + " property values in file " + propertiesUrl); - for (final Map.Entry entry : properties.entrySet()) { - this.log.debug("Found '" + entry.getKey() + "=" + entry.getValue() + "'"); + for (final Object group : yaml.loadAll(fileContent)) { + final Map flattened = this.flatten((Map) group); + final Properties properties = new Properties(); + properties.putAll(flattened); + propertiesList.add(properties); + } + + // Logging all found properties for debug + if (this.log.isDebugEnabled()) { + for (final Properties properties : propertiesList) { + this.log.debug("Found " + properties.size() + " property values in file " + propertiesUrl.getFile()); + for (Map.Entry property : properties.entrySet()) { + this.log.debug("Found '" + property.getKey() + "=" + property.getValue() + "'"); + } + } } // Returning parsed properties - return properties; + return propertiesList; } catch (final IOException e) { - throw new MetadataFileNotFoundException("Failed reading " + propertiesUrl, e); + throw new MetadataFileNotFoundException("Failed reading " + propertiesUrl.getFile(), e); } } diff --git a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/reporting/DefaultReportingService.java b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/reporting/DefaultReportingService.java index 1aa367b..2cff214 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/reporting/DefaultReportingService.java +++ b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/components/reporting/DefaultReportingService.java @@ -71,7 +71,7 @@ public ArtifactMetadata report(final List aggregate) this.log.warn("No aggregation file found for previous version, skipping comparison"); this.log.debug(e); } catch (final Exception e) { - this.log.warn("Failed to compare with previous version", e); + this.log.warn("Failed to compare with previous version"); this.log.debug(e); } diff --git a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/AggregationService.java b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/AggregationService.java index 0778dee..a89f3db 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/AggregationService.java +++ b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/AggregationService.java @@ -6,6 +6,7 @@ import org.eclipse.aether.artifact.Artifact; import java.util.List; +import java.util.Set; public interface AggregationService { @@ -14,9 +15,10 @@ public interface AggregationService { * Combines all metadata files from the project and of its dependencies. * * @param propertiesFiles the list of properties files to extract default values from + * @param profiles the list of spring profiles to extract default values from (can be null to accept all) * @return the list of aggregated properties metadata */ - List aggregate(final List propertiesFiles); + List aggregate(final List propertiesFiles, final Set profiles); /** * Loads the aggregated configuration properties metadata of the current project. diff --git a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/model/AggregatedPropertyMetadata.java b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/model/AggregatedPropertyMetadata.java index d83a0ac..8e2e2db 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/model/AggregatedPropertyMetadata.java +++ b/spring-configuration-aggregator-maven-plugin/src/main/java/com/github/egoettelmann/spring/configuration/extensions/aggregator/maven/core/model/AggregatedPropertyMetadata.java @@ -3,6 +3,7 @@ import lombok.Data; import java.util.List; +import java.util.Map; @Data public class AggregatedPropertyMetadata { @@ -11,6 +12,7 @@ public class AggregatedPropertyMetadata { private String type; private String description; private String defaultValue; + private Map profiles; private List sourceTypes; @Data diff --git a/spring-configuration-aggregator-maven-plugin/src/main/resources/default.ftl b/spring-configuration-aggregator-maven-plugin/src/main/resources/default.ftl index 7d9800c..88384b2 100644 --- a/spring-configuration-aggregator-maven-plugin/src/main/resources/default.ftl +++ b/spring-configuration-aggregator-maven-plugin/src/main/resources/default.ftl @@ -118,6 +118,15 @@

${(property.description)!}

+ <#if property.profiles?has_content> + Spring profiles: + <#list property.profiles as profile, value> +
+ ${profile} + : + ${(value?j_string)!} + + diff --git a/spring-configuration-extensions-samples/pom.xml b/spring-configuration-extensions-samples/pom.xml index 790ec1d..f5594ff 100644 --- a/spring-configuration-extensions-samples/pom.xml +++ b/spring-configuration-extensions-samples/pom.xml @@ -86,10 +86,6 @@ ${project.groupId}
- - ${project.basedir}/src/main/resources/application.yml - ${project.basedir}/src/main/resources/application-sample.properties - json diff --git a/spring-configuration-extensions-samples/src/main/resources/application-sample.properties b/spring-configuration-extensions-samples/src/main/resources/application-sample.properties deleted file mode 100644 index 74d043b..0000000 --- a/spring-configuration-extensions-samples/src/main/resources/application-sample.properties +++ /dev/null @@ -1 +0,0 @@ -sample.unicode.chars=\u0000\u0001\u0002\u0003\u0004\u0005 diff --git a/spring-configuration-extensions-samples/src/main/resources/application-sample.yml b/spring-configuration-extensions-samples/src/main/resources/application-sample.yml new file mode 100644 index 0000000..d86b9bc --- /dev/null +++ b/spring-configuration-extensions-samples/src/main/resources/application-sample.yml @@ -0,0 +1,3 @@ +sample: + unicode: + chars: \u0000\u0001\u0002\u0003\u0004\u0005 diff --git a/spring-configuration-extensions-samples/src/main/resources/application.yml b/spring-configuration-extensions-samples/src/main/resources/application.yml index 56aa0be..922cb41 100644 --- a/spring-configuration-extensions-samples/src/main/resources/application.yml +++ b/spring-configuration-extensions-samples/src/main/resources/application.yml @@ -3,3 +3,17 @@ sample: title: "Sample Application" custom: conf: "Custom Config Value" + +--- +spring: + config.activate.on-profile: default,sample2 +sample: + unicode: + chars: "-" + +--- +spring: + config.activate.on-profile: sample2 +sample: + custom: + conf: "Custom Config Value for sample2" diff --git a/spring-configuration-extensions-samples/src/test/resources/aggregated-spring-configuration-metadata-test-1.json b/spring-configuration-extensions-samples/src/test/resources/aggregated-spring-configuration-metadata-test-1.json index 2a26125..85594e5 100644 --- a/spring-configuration-extensions-samples/src/test/resources/aggregated-spring-configuration-metadata-test-1.json +++ b/spring-configuration-extensions-samples/src/test/resources/aggregated-spring-configuration-metadata-test-1.json @@ -4,6 +4,7 @@ "type" : "java.lang.String", "description" : "Sample app title injected through @ConfigurationProperties", "defaultValue" : "Sample Application", + "profiles" : null, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", @@ -14,11 +15,14 @@ "type" : "java.lang.String", "description" : "Custom config value injected by @Value.\n\nCustom config value injected by @Value, with default value referencing another config.", "defaultValue" : "Custom Config Value", + "profiles" : { + "sample2" : "Custom Config Value for sample2" + }, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", "sourceType" : "com.github.egoettelmann.spring.configuration.extensions.samples.config.SampleConfig" - }, { + }, { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", "sourceType" : "com.github.egoettelmann.spring.configuration.extensions.samples.config.SampleConfig2" @@ -28,6 +32,7 @@ "type" : "java.lang.String", "description" : "Custom config value injected by @Value, with default value referencing another config.\n", "defaultValue" : "${sample.custom.conf}", + "profiles" : null, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", @@ -37,7 +42,11 @@ "name" : "sample.unicode.chars", "type" : "java.lang.String", "description" : "Config including unicode characters.\n", - "defaultValue" : "\u0000\u0001\u0002\u0003\u0004\u0005", + "defaultValue" : "-", + "profiles" : { + "sample" : "\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005", + "sample2" : "-" + }, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", diff --git a/spring-configuration-extensions-samples/src/test/resources/report-test-1.json b/spring-configuration-extensions-samples/src/test/resources/report-test-1.json index 956994e..5b27a74 100644 --- a/spring-configuration-extensions-samples/src/test/resources/report-test-1.json +++ b/spring-configuration-extensions-samples/src/test/resources/report-test-1.json @@ -10,6 +10,7 @@ "type" : "java.lang.String", "description" : "Sample app title injected through @ConfigurationProperties", "defaultValue" : "Sample Application", + "profiles" : null, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", @@ -20,6 +21,9 @@ "type" : "java.lang.String", "description" : "Custom config value injected by @Value.\n\nCustom config value injected by @Value, with default value referencing another config.", "defaultValue" : "Custom Config Value", + "profiles" : { + "sample2" : "Custom Config Value for sample2" + }, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", @@ -34,6 +38,7 @@ "type" : "java.lang.String", "description" : "Custom config value injected by @Value, with default value referencing another config.\n", "defaultValue" : "${sample.custom.conf}", + "profiles" : null, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples", @@ -43,7 +48,11 @@ "name" : "sample.unicode.chars", "type" : "java.lang.String", "description" : "Config including unicode characters.\n", - "defaultValue" : "\u0000\u0001\u0002\u0003\u0004\u0005", + "defaultValue" : "-", + "profiles" : { + "sample" : "\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005", + "sample2" : "-" + }, "sourceTypes" : [ { "groupId" : "com.github.egoettelmann", "artifactId" : "spring-configuration-extensions-samples",