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


Java StandardBeanExpressionResolver类代码示例

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


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

示例1: setupProcessor

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
/**
 * Sets up the bean post processor and conversion service
 *
 * @param beans - The bean factory for the the dictionary beans
 */
public static void setupProcessor(DefaultListableBeanFactory beans) {
    try {
        // UIF post processor that sets component ids
        BeanPostProcessor idPostProcessor = ComponentBeanPostProcessor.class.newInstance();
        beans.addBeanPostProcessor(idPostProcessor);
        beans.setBeanExpressionResolver(new StandardBeanExpressionResolver() {
            @Override
            protected void customizeEvaluationContext(StandardEvaluationContext evalContext) {
                try {
                    evalContext.registerFunction("getService", ExpressionFunctions.class.getDeclaredMethod("getService", new Class[]{String.class}));
                } catch(NoSuchMethodException me) {
                    LOG.error("Unable to register custom expression to data dictionary bean factory", me);
                }
            }
        });

        // special converters for shorthand map and list property syntax
        GenericConversionService conversionService = new GenericConversionService();
        conversionService.addConverter(new StringMapConverter());
        conversionService.addConverter(new StringListConverter());

        beans.setConversionService(conversionService);
    } catch (Exception e1) {
        throw new DataDictionaryException("Cannot create component decorator post processor: " + e1.getMessage(),
                e1);
    }
}
 
开发者ID:kuali,项目名称:rice,代码行数:33,代码来源:DataDictionary.java

示例2: setupProcessor

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
/**
 * Sets up the bean post processor and conversion service
 *
 * @param beans - The bean factory for the the dictionary beans
 */
public static void setupProcessor(KualiDefaultListableBeanFactory beans) {
    try {
        // UIF post processor that sets component ids
        BeanPostProcessor idPostProcessor = ComponentBeanPostProcessor.class.newInstance();
        beans.addBeanPostProcessor(idPostProcessor);
        beans.setBeanExpressionResolver(new StandardBeanExpressionResolver());

        // special converters for shorthand map and list property syntax
        GenericConversionService conversionService = new GenericConversionService();
        conversionService.addConverter(new StringMapConverter());
        conversionService.addConverter(new StringListConverter());

        beans.setConversionService(conversionService);
    } catch (Exception e1) {
        throw new DataDictionaryException("Cannot create component decorator post processor: " + e1.getMessage(),
                e1);
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:24,代码来源:DataDictionary.java

示例3: prepareBeanFactory

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
/**
 * Configure the factory's standard context characteristics,
 * such as the context's ClassLoader and post-processors.
 * @param beanFactory the BeanFactory to configure
 */
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	// Tell the internal bean factory to use the context's class loader etc.
	beanFactory.setBeanClassLoader(getClassLoader());
	beanFactory.setBeanExpressionResolver(new StandardBeanExpressionResolver());
	beanFactory.addPropertyEditorRegistrar(new ResourceEditorRegistrar(this, getEnvironment()));

	// Configure the bean factory with context callbacks.
	beanFactory.addBeanPostProcessor(new ApplicationContextAwareProcessor(this));
	beanFactory.ignoreDependencyInterface(ResourceLoaderAware.class);
	beanFactory.ignoreDependencyInterface(ApplicationEventPublisherAware.class);
	beanFactory.ignoreDependencyInterface(MessageSourceAware.class);
	beanFactory.ignoreDependencyInterface(ApplicationContextAware.class);
	beanFactory.ignoreDependencyInterface(EnvironmentAware.class);

	// BeanFactory interface not registered as resolvable type in a plain factory.
	// MessageSource registered (and found for autowiring) as a bean.
	beanFactory.registerResolvableDependency(BeanFactory.class, beanFactory);
	beanFactory.registerResolvableDependency(ResourceLoader.class, this);
	beanFactory.registerResolvableDependency(ApplicationEventPublisher.class, this);
	beanFactory.registerResolvableDependency(ApplicationContext.class, this);

	// Detect a LoadTimeWeaver and prepare for weaving, if found.
	if (beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {
		beanFactory.addBeanPostProcessor(new LoadTimeWeaverAwareProcessor(beanFactory));
		// Set a temporary ClassLoader for type matching.
		beanFactory.setTempClassLoader(new ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader()));
	}

	// Register default environment beans.
	if (!beanFactory.containsLocalBean(ENVIRONMENT_BEAN_NAME)) {
		beanFactory.registerSingleton(ENVIRONMENT_BEAN_NAME, getEnvironment());
	}
	if (!beanFactory.containsLocalBean(SYSTEM_PROPERTIES_BEAN_NAME)) {
		beanFactory.registerSingleton(SYSTEM_PROPERTIES_BEAN_NAME, getEnvironment().getSystemProperties());
	}
	if (!beanFactory.containsLocalBean(SYSTEM_ENVIRONMENT_BEAN_NAME)) {
		beanFactory.registerSingleton(SYSTEM_ENVIRONMENT_BEAN_NAME, getEnvironment().getSystemEnvironment());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:45,代码来源:AbstractApplicationContext.java

示例4: prepareBeanFactory

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
/**
 * Configure the factory's standard context characteristics,
 * such as the context's ClassLoader and post-processors.
 * @param beanFactory the BeanFactory to configure
 */
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	// Tell the internal bean factory to use the context's class loader etc.
	beanFactory.setBeanClassLoader(getClassLoader());
	beanFactory.setBeanExpressionResolver(new StandardBeanExpressionResolver(beanFactory.getBeanClassLoader()));
	beanFactory.addPropertyEditorRegistrar(new ResourceEditorRegistrar(this, getEnvironment()));

	// Configure the bean factory with context callbacks.
	beanFactory.addBeanPostProcessor(new ApplicationContextAwareProcessor(this));
	beanFactory.ignoreDependencyInterface(ResourceLoaderAware.class);
	beanFactory.ignoreDependencyInterface(ApplicationEventPublisherAware.class);
	beanFactory.ignoreDependencyInterface(MessageSourceAware.class);
	beanFactory.ignoreDependencyInterface(ApplicationContextAware.class);
	beanFactory.ignoreDependencyInterface(EnvironmentAware.class);

	// BeanFactory interface not registered as resolvable type in a plain factory.
	// MessageSource registered (and found for autowiring) as a bean.
	beanFactory.registerResolvableDependency(BeanFactory.class, beanFactory);
	beanFactory.registerResolvableDependency(ResourceLoader.class, this);
	beanFactory.registerResolvableDependency(ApplicationEventPublisher.class, this);
	beanFactory.registerResolvableDependency(ApplicationContext.class, this);

	// Detect a LoadTimeWeaver and prepare for weaving, if found.
	if (beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {
		beanFactory.addBeanPostProcessor(new LoadTimeWeaverAwareProcessor(beanFactory));
		// Set a temporary ClassLoader for type matching.
		beanFactory.setTempClassLoader(new ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader()));
	}

	// Register default environment beans.
	if (!beanFactory.containsLocalBean(ENVIRONMENT_BEAN_NAME)) {
		beanFactory.registerSingleton(ENVIRONMENT_BEAN_NAME, getEnvironment());
	}
	if (!beanFactory.containsLocalBean(SYSTEM_PROPERTIES_BEAN_NAME)) {
		beanFactory.registerSingleton(SYSTEM_PROPERTIES_BEAN_NAME, getEnvironment().getSystemProperties());
	}
	if (!beanFactory.containsLocalBean(SYSTEM_ENVIRONMENT_BEAN_NAME)) {
		beanFactory.registerSingleton(SYSTEM_ENVIRONMENT_BEAN_NAME, getEnvironment().getSystemEnvironment());
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:45,代码来源:AbstractApplicationContext.java

示例5: setUp

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	this.beanFactory.registerScope("request", new RequestScope());
	this.beanFactory.setBeanExpressionResolver(new StandardBeanExpressionResolver());
	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
	reader.loadBeanDefinitions(new ClassPathResource("requestScopeTests.xml", getClass()));
	this.beanFactory.preInstantiateSingletons();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:RequestScopeTests.java

示例6: setupProcessor

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
/**
 * Sets up the bean post processor and conversion service
 *
 * @param beans - The bean factory for the the dictionary beans
 */
public static void setupProcessor(DefaultListableBeanFactory beans) {
    try {
        // UIF post processor that sets component ids
        BeanPostProcessor idPostProcessor = ComponentBeanPostProcessor.class.newInstance();
        beans.addBeanPostProcessor(idPostProcessor);
        beans.setBeanExpressionResolver(new StandardBeanExpressionResolver() {
            @Override
            protected void customizeEvaluationContext(StandardEvaluationContext evalContext) {
                try {
                    evalContext.registerFunction("getService", ExpressionFunctions.class.getDeclaredMethod("getService", String.class));
                } catch(NoSuchMethodException me) {
                    LOG.error("Unable to register custom expression to data dictionary bean factory", me);
                }
            }
        });

        // special converters for shorthand map and list property syntax
        GenericConversionService conversionService = new GenericConversionService();
        conversionService.addConverter(new StringMapConverter());
        conversionService.addConverter(new StringListConverter());

        beans.setConversionService(conversionService);
    } catch (Exception e1) {
        throw new DataDictionaryException("Cannot create component decorator post processor: " + e1.getMessage(),
                e1);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:DataDictionaryPostProcessorUtils.java

示例7: setUp

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
	this.beanFactory = new DefaultListableBeanFactory();
	this.beanFactory.registerScope("request", new RequestScope());
	this.beanFactory.setBeanExpressionResolver(new StandardBeanExpressionResolver());
	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
	reader.loadBeanDefinitions(new ClassPathResource("requestScopeTests.xml", getClass()));
	this.beanFactory.preInstantiateSingletons();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:10,代码来源:RequestScopeTests.java

示例8: bean

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
private boolean bean(String expression) {
	return expression.startsWith(StandardBeanExpressionResolver.DEFAULT_EXPRESSION_PREFIX)
			&& expression.endsWith(StandardBeanExpressionResolver.DEFAULT_EXPRESSION_SUFFIX);
}
 
开发者ID:ljtfreitas,项目名称:java-restify,代码行数:5,代码来源:SpelDynamicParameterExpressionResolver.java

示例9: parseDataDictionaryConfigurationFiles

import org.springframework.context.expression.StandardBeanExpressionResolver; //导入依赖的package包/类
public void parseDataDictionaryConfigurationFiles( boolean allowConcurrentValidation ) {
    // configure the bean factory, setup component decorator post processor
    // and allow Spring EL
    try {
        BeanPostProcessor idPostProcessor = ComponentBeanPostProcessor.class.newInstance();
        ddBeans.addBeanPostProcessor(idPostProcessor);
        ddBeans.setBeanExpressionResolver(new StandardBeanExpressionResolver());

        GenericConversionService conversionService = new GenericConversionService();
        conversionService.addConverter(new StringMapConverter());
        conversionService.addConverter(new StringListConverter());
        ddBeans.setConversionService(conversionService);
    } catch (Exception e1) {
        LOG.error("Cannot create component decorator post processor: " + e1.getMessage(), e1);
        throw new RuntimeException("Cannot create component decorator post processor: " + e1.getMessage(), e1);
    }

    // expand configuration locations into files
    LOG.info("Starting DD XML File Load");

    String[] configFileLocationsArray = new String[configFileLocations.size()];
    configFileLocationsArray = configFileLocations.toArray(configFileLocationsArray);
    configFileLocations.clear(); // empty the list out so other items can be added
    try {
        xmlReader.loadBeanDefinitions(configFileLocationsArray);
    } catch (Exception e) {
        LOG.error("Error loading bean definitions", e);
        throw new DataDictionaryException("Error loading bean definitions: " + e.getLocalizedMessage());
    }
    LOG.info("Completed DD XML File Load");

    UifBeanFactoryPostProcessor factoryPostProcessor = new UifBeanFactoryPostProcessor();
    factoryPostProcessor.postProcessBeanFactory(ddBeans);

    // indexing
    if (allowConcurrentValidation) {
        Thread t = new Thread(ddIndex);
        t.start();

        Thread t2 = new Thread(uifIndex);
        t2.start();
    } else {
        ddIndex.run();
        uifIndex.run();
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:47,代码来源:DataDictionary.java


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