本文整理匯總了Java中org.springframework.context.support.GenericXmlApplicationContext.getAutowireCapableBeanFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericXmlApplicationContext.getAutowireCapableBeanFactory方法的具體用法?Java GenericXmlApplicationContext.getAutowireCapableBeanFactory怎麽用?Java GenericXmlApplicationContext.getAutowireCapableBeanFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.context.support.GenericXmlApplicationContext
的用法示例。
在下文中一共展示了GenericXmlApplicationContext.getAutowireCapableBeanFactory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testContextConfiguration
import org.springframework.context.support.GenericXmlApplicationContext; //導入方法依賴的package包/類
private void testContextConfiguration(String profile, String springProfile) {
GenericXmlApplicationContext context = createContext(profile, springProfile);
AutowireCapableBeanFactory factory = context.getAutowireCapableBeanFactory();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ResourceLoader resourceLoader = new MultiLoader(classLoader);
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
Collection<Class<?>> descendants = classFinder.getDescendants(Object.class, "com.hotwire.test.steps");
List<Throwable> throwables = new ArrayList<>();
for (Class<?> clazz : descendants) {
if (Utils.isInstantiable(clazz) & !clazz.isEnum()) {
context.registerBeanDefinition(clazz.getName(),
BeanDefinitionBuilder.genericBeanDefinition(clazz).getBeanDefinition());
try {
factory.getBean(clazz.getName());
}
catch (Throwable t) {
while (t.getCause() != null) {
t = t.getCause();
}
System.err.println(t.getMessage());
throwables.add(t);
}
}
}
assertThat(throwables)
.as("List of throwables should be empty!")
.isEmpty();
}
示例2: initApplicationContext
import org.springframework.context.support.GenericXmlApplicationContext; //導入方法依賴的package包/類
private void initApplicationContext(CommandLine line) {
String validatedRepo = line.getOptionValue(validatedRepositoryOption.getOpt(), "workspace/validated-repository");
String validatedDist = line.getOptionValue(validatedDistributionOption.getOpt(), "workspace/validated-distribution");
String localRepo = line.getOptionValue(localRepositoryOption.getOpt(), "workspace/local-repository");
String[] remoteRepos = line.getOptionValues(remoteRepositoryOption.getOpt());
System.setProperty("redhat-repository-validator-validatedRepository", validatedRepo);
System.setProperty("redhat-repository-validator-validatedDistribution", validatedDist);
System.setProperty("redhat-repository-validator-localRepository", localRepo);
System.setProperty("redhat-repository-validator-remoteRepositories", StringUtils.defaultString(StringUtils.join(remoteRepos, ';')));
String userConfigFile = line.getOptionValue(configOption.getOpt());
if (userConfigFile == null) {
File defaultUserConfig = new File("redhat-repository-validator-config.xml");
if (defaultUserConfig.exists() && defaultUserConfig.isFile()) {
userConfigFile = defaultUserConfig.getAbsolutePath();
}
}
List<Resource> resources = new ArrayList<Resource>();
resources.add(new ClassPathResource("redhat-repository-validator-app-context.xml"));
if (userConfigFile != null) {
resources.add(new FileSystemResource(userConfigFile));
}
appCtx = new GenericXmlApplicationContext(resources.toArray(new Resource[] {}));
AutowireCapableBeanFactory autowireCapableBeanFactory = appCtx.getAutowireCapableBeanFactory();
autowireCapableBeanFactory.autowireBean(this);
}
示例3: initAppContext
import org.springframework.context.support.GenericXmlApplicationContext; //導入方法依賴的package包/類
protected void initAppContext(String appConfigClassPath) {
Resource config = new ClassPathResource(appConfigClassPath);
appCtx = new GenericXmlApplicationContext(config);
AutowireCapableBeanFactory autowireCapableBeanFactory = appCtx.getAutowireCapableBeanFactory();
autowireCapableBeanFactory.autowireBean(this);
}
開發者ID:release-engineering,項目名稱:redhat-repository-validator,代碼行數:8,代碼來源:AbstractExceptionFilterParserTest.java