001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.env; 018 019import java.io.IOException; 020import java.util.List; 021 022import org.springframework.core.env.PropertySource; 023import org.springframework.core.io.Resource; 024import org.springframework.core.io.support.SpringFactoriesLoader; 025 026/** 027 * Strategy interface located via {@link SpringFactoriesLoader} and used to load a 028 * {@link PropertySource}. 029 * 030 * @author Dave Syer 031 * @author Phillip Webb 032 */ 033public interface PropertySourceLoader { 034 035 /** 036 * Returns the file extensions that the loader supports (excluding the '.'). 037 * @return the file extensions 038 */ 039 String[] getFileExtensions(); 040 041 /** 042 * Load the resource into one or more property sources. Implementations may either 043 * return a list containing a single source, or in the case of a multi-document format 044 * such as yaml a source for each document in the resource. 045 * @param name the root name of the property source. If multiple documents are loaded 046 * an additional suffix should be added to the name for each source loaded. 047 * @param resource the resource to load 048 * @return a list property sources 049 * @throws IOException if the source cannot be loaded 050 */ 051 List<PropertySource<?>> load(String name, Resource resource) throws IOException; 052 053}