use of org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository in project cas by apereo.
the class CasConfigurationMetadataCatalog method collectReferenceProperty.
private static CasReferenceProperty collectReferenceProperty(final ConfigurationMetadataProperty property, final ConfigurationMetadataRepository repository) {
if (repository.getAllGroups().containsKey(property.getId())) {
return null;
}
val builder = CasReferenceProperty.builder();
builder.owner(determinePropertySourceType(property));
property.getHints().getValueHints().forEach(Unchecked.consumer(hint -> {
val description = hint.getDescription();
if (StringUtils.isNotBlank(description)) {
if (description.equals(RequiredProperty.class.getName())) {
builder.required(true);
}
if (description.equals(RequiresModule.class.getName())) {
val results = MAPPER.readValue(hint.getValue().toString(), Map.class);
builder.module(results.get("module").toString());
}
if (description.equals(PropertyOwner.class.getName())) {
val results = MAPPER.readValue(hint.getValue().toString(), Map.class);
builder.owner(results.get("owner").toString());
}
if (description.equals(DurationCapable.class.getName())) {
builder.duration(true);
}
if (description.equals(ExpressionLanguageCapable.class.getName())) {
builder.expressionLanguage(true);
}
}
}));
builder.type(property.getType());
val description = StringUtils.defaultString(StringUtils.defaultIfBlank(property.getDescription(), property.getShortDescription()));
builder.description(description);
builder.shortDescription(property.getShortDescription());
builder.name(property.getId());
builder.defaultValue(ObjectUtils.defaultIfNull(property.getDefaultValue(), StringUtils.EMPTY));
if (property.isDeprecated()) {
val deprecation = property.getDeprecation();
builder.deprecationLevel(deprecation.getLevel().toString());
if (deprecation.getShortReason() != null) {
builder.deprecationReason(deprecation.getShortReason());
}
if (deprecation.getReplacement() != null) {
builder.deprecationReplacement(deprecation.getReplacement());
}
}
return builder.build();
}
use of org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository in project microservices by pwillhan.
the class MetaDataTests method writeMetadataInfo.
@Test
public void writeMetadataInfo() throws Exception {
InputStream inputStream = new FileInputStream("target/classes/META-INF/spring-configuration-metadata.json");
ConfigurationMetadataRepository repository = ConfigurationMetadataRepositoryJsonBuilder.create(UTF_8).withJsonResource(inputStream).build();
for (Map.Entry<String, ConfigurationMetadataProperty> entry : repository.getAllProperties().entrySet()) {
System.out.println(entry.getKey() + " = " + entry.getValue().getShortDescription());
}
}
use of org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository in project spring-boot by spring-projects.
the class PropertiesMigrationListener method onApplicationPreparedEvent.
private void onApplicationPreparedEvent(ApplicationPreparedEvent event) {
ConfigurationMetadataRepository repository = loadRepository();
PropertiesMigrationReporter reporter = new PropertiesMigrationReporter(repository, event.getApplicationContext().getEnvironment());
this.report = reporter.getReport();
}
Aggregations