当前位置: 首页>>代码示例>>Java>>正文


Java SpringApplicationContext类代码示例

本文整理汇总了Java中org.unitils.spring.annotation.SpringApplicationContext的典型用法代码示例。如果您正苦于以下问题:Java SpringApplicationContext类的具体用法?Java SpringApplicationContext怎么用?Java SpringApplicationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SpringApplicationContext类属于org.unitils.spring.annotation包,在下文中一共展示了SpringApplicationContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkIfEverythingIsInPlace

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
/**
 * This method checks if the testclass contains a {@link SpringApplicationContext} and a {@link ConfigureProfile}.
 * 
 * @param testClass
 * @return boolean
 */
protected boolean checkIfEverythingIsInPlace(Class<?> testClass) {
    if (!testClass.isAnnotationPresent(ConfigureProfile.class)) {
        LOGGER.warn("The annotation 'ConfigureProfile' is not present.");
        return false;
    }
    ConfigureProfile configProfile = testClass.getAnnotation(ConfigureProfile.class);
    if (StringUtils.isEmpty(configProfile.value())) {
        throw new UnitilsException("The name of the profile should be filled in.");
    }

    //type of configuration is ApplicationContext
    if (configProfile.configuration().equals(TypeConfiguration.APPLICATIONCONTEXT)) {
        if (!testClass.isAnnotationPresent(SpringApplicationContext.class)) {
            throw new UnitilsException("The annotation 'SpringApplicationContext' is not present.");
        }
    } else {
        //type of the configuration is the annotation Configuration.
        if (StringUtils.isEmpty(configProfile.packageProfile())) {
            throw new UnitilsException("You should fill in the name of the package of the profile.");
        }
    }

    return true;
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:31,代码来源:ProfileModule.java

示例2: createMethod2

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod2(List<String> locations) {
    createMethod2Called = true;
    assertLenientEquals(asList("classpath:org/unitils/spring/services-config.xml"), locations);
    createMethod2Called = true;
    return new ClassPathXmlApplicationContext("classpath:org/unitils/spring/services-config.xml");
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:8,代码来源:SpringModuleApplicationContextInheritanceTest.java

示例3: setField

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
public void setField(ApplicationContext setter) {
    this.setter = setter;
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:5,代码来源:SpringModuleInjectApplicationContextTest.java

示例4: setField

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext({"classpath:org/unitils/spring/services-config.xml", "classpath:org/unitils/spring/services-config.xml"})
public void setField(ApplicationContext field) {
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:4,代码来源:SpringModuleApplicationContextTest.java

示例5: createMethod

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod() {
    return new ClassPathXmlApplicationContext("classpath:org/unitils/spring/services-config.xml");
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:5,代码来源:SpringModuleApplicationContextTest.java

示例6: createMethod1

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod1(List<String> locations) {
    return null;
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:5,代码来源:SpringModuleApplicationContextTest.java

示例7: createMethod2

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod2(List<String> locations) {
    return null;
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:5,代码来源:SpringModuleApplicationContextTest.java

示例8: createMethod1

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod1(List<String> locations) {
    createMethod1Called = true;
    return new ClassPathXmlApplicationContext("classpath:org/unitils/spring/services-config.xml");
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:6,代码来源:SpringModuleApplicationContextInheritanceTest.java

示例9: ApplicationContextManager

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
/**
 * Creates a new instance, using the given {@link ApplicationContextFactory}. The given list of
 * <code>BeanPostProcessor</code>s will be registered on all <code>ApplicationContext</code>s that are
 * created.
 *
 * @param applicationContextFactory The factory for creating <code>ApplicationContext</code>s, not null.
 */
public ApplicationContextManager(ApplicationContextFactory applicationContextFactory) {
    super(ApplicationContext.class, SpringApplicationContext.class);
    this.applicationContextFactory = applicationContextFactory;
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:12,代码来源:ApplicationContextManager.java

示例10: getAnnotationValues

import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
/**
 * Gets the locations that are specified for the given {@link SpringApplicationContext} annotation. An array with
 * 1 empty string should be considered to be empty and null should be returned.
 *
 * @param annotation The annotation, not null
 * @return The locations, null if no values were specified
 */
@Override
protected List<String> getAnnotationValues(SpringApplicationContext annotation) {
    String[] locations = annotation.value();
    return asList(locations);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:13,代码来源:ApplicationContextManager.java


注:本文中的org.unitils.spring.annotation.SpringApplicationContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。