public FilePropertySource()

in core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FilePropertySource.java [40:73]


    public FilePropertySource(String name, ApplicationContext applicationContext, String directory) {
        super(name);
        StringHelper.notEmpty(directory, "directory");

        Properties loaded = new Properties();
        try {
            Resource[] files = applicationContext.getResources(directory);
            for (Resource file : files) {
                if (file.exists()) {
                    try (FileInputStream fis = new FileInputStream(file.getFile())) {
                        LOG.debug("Loading properties from file: {}", file);
                        Properties extra = new Properties();
                        extra.load(fis);
                        if (!extra.isEmpty()) {
                            loaded.putAll(extra);
                        }
                    } catch (IOException e) {
                        // ignore
                    }
                }
            }
        } catch (IOException e) {
            // ignore
        }

        // if we loaded any files then store as properties
        if (loaded.isEmpty()) {
            properties = null;
            LOG.warn("No properties found while loading from: {}", directory);
        } else {
            properties = loaded;
            LOG.info("Loaded {} properties from: {}", properties.size(), directory);
        }
    }