1 16 17 package org.springframework.context.support; 18 19 import org.springframework.beans.BeansException; 20 import org.springframework.context.ApplicationContext; 21 import org.springframework.core.io.FileSystemResource; 22 import org.springframework.core.io.Resource; 23 24 55 public class FileSystemXmlApplicationContext extends AbstractXmlApplicationContext { 56 57 private String [] configLocations; 58 59 60 66 public FileSystemXmlApplicationContext(String configLocation) throws BeansException { 67 this(new String [] {configLocation}); 68 } 69 70 76 public FileSystemXmlApplicationContext(String [] configLocations) throws BeansException { 77 this(configLocations, null); 78 } 79 80 88 public FileSystemXmlApplicationContext(String [] configLocations, ApplicationContext parent) 89 throws BeansException { 90 91 super(parent); 92 this.configLocations = configLocations; 93 refresh(); 94 } 95 96 97 107 public FileSystemXmlApplicationContext(String [] configLocations, boolean refresh) throws BeansException { 108 this(configLocations, refresh, null); 109 } 110 111 122 public FileSystemXmlApplicationContext(String [] configLocations, boolean refresh, ApplicationContext parent) 123 throws BeansException { 124 125 super(parent); 126 this.configLocations = configLocations; 127 if (refresh) { 128 refresh(); 129 } 130 } 131 132 133 protected String [] getConfigLocations() { 134 return this.configLocations; 135 } 136 137 146 protected Resource getResourceByPath(String path) { 147 if (path != null && path.startsWith("/")) { 148 path = path.substring(1); 149 } 150 return new FileSystemResource(path); 151 } 152 153 } 154 | Popular Tags |