Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronweissler committed Mar 28, 2022
1 parent 6d1f654 commit b39b1f5
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.config.YamlProcessor;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver;
Expand Down Expand Up @@ -39,16 +38,14 @@ public InspectitConfig parseConfig(String configYaml) throws IOException {

if (!StringUtils.isEmpty(configYaml)) {

File tempFile = File.createTempFile("temp-", ".tmp");
File tempFile = File.createTempFile("inspectit-ocelot-configdocsgenerator-temp-config-", ".yml");
try (BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile))) {
writer.write(configYaml);
}

// Read yaml into Properties
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new FileUrlResource(tempFile.getAbsolutePath()));
factory.setDocumentMatchers((profile) -> YamlProcessor.MatchStatus.FOUND);
factory.afterPropertiesSet();
Properties properties = factory.getObject();

// Create ConfigurationPropertySource from Properties
Expand Down

0 comments on commit b39b1f5

Please sign in to comment.