mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-23 16:05:09 +00:00

# Description Please provide a summary of the changes, including relevant motivation and context. Closes #(issue_number) ## Checklist - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have performed a self-review of my own code - [ ] I have attached images of the change if it is UI based - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] If my code has heavily changed functionality I have updated relevant docs on [Stirling-PDFs doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) - [ ] My changes generate no new warnings - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) --------- Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com> Co-authored-by: a <a>
25 lines
951 B
Java
25 lines
951 B
Java
package stirling.software.SPDF.config;
|
|
|
|
import java.io.IOException;
|
|
import java.util.Properties;
|
|
|
|
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
|
import org.springframework.core.env.PropertiesPropertySource;
|
|
import org.springframework.core.env.PropertySource;
|
|
import org.springframework.core.io.support.EncodedResource;
|
|
import org.springframework.core.io.support.PropertySourceFactory;
|
|
|
|
public class YamlPropertySourceFactory implements PropertySourceFactory {
|
|
|
|
@Override
|
|
public PropertySource<?> createPropertySource(String name, EncodedResource encodedResource)
|
|
throws IOException {
|
|
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
|
|
factory.setResources(encodedResource.getResource());
|
|
Properties properties = factory.getObject();
|
|
|
|
return new PropertiesPropertySource(
|
|
encodedResource.getResource().getFilename(), properties);
|
|
}
|
|
}
|