Search in sources :

Example 1 with CasEmbeddedValueResolver

use of org.apereo.cas.CasEmbeddedValueResolver in project cas by apereo.

the class EnvironmentConversionServiceInitializer method initialize.

@Override
public void initialize(final ConfigurableApplicationContext ctx) {
    final DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(true);
    conversionService.setEmbeddedValueResolver(new CasEmbeddedValueResolver(ctx));
    ctx.getEnvironment().setConversionService(conversionService);
}
Also used : CasEmbeddedValueResolver(org.apereo.cas.CasEmbeddedValueResolver) DefaultFormattingConversionService(org.springframework.format.support.DefaultFormattingConversionService)

Example 2 with CasEmbeddedValueResolver

use of org.apereo.cas.CasEmbeddedValueResolver in project cas by apereo.

the class CasWebApplicationContext method onRefresh.

/**
 * {@inheritDoc}
 * Reset the value resolver on the inner {@link ScheduledAnnotationBeanPostProcessor}
 * so that we can parse durations. This is due to how {@link org.springframework.scheduling.annotation.SchedulingConfiguration}
 * creates the processor and does not provide a way for one to inject a value resolver.
 */
@Override
protected void onRefresh() {
    final ScheduledAnnotationBeanPostProcessor sch = (ScheduledAnnotationBeanPostProcessor) getBeanFactory().getBean(TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME, BeanPostProcessor.class);
    sch.setEmbeddedValueResolver(new CasEmbeddedValueResolver(this));
    super.onRefresh();
}
Also used : ScheduledAnnotationBeanPostProcessor(org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor) CasEmbeddedValueResolver(org.apereo.cas.CasEmbeddedValueResolver) BeanPostProcessor(org.springframework.beans.factory.config.BeanPostProcessor) ScheduledAnnotationBeanPostProcessor(org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor)

Example 3 with CasEmbeddedValueResolver

use of org.apereo.cas.CasEmbeddedValueResolver in project cas by apereo.

the class SchedulingUtils method prepScheduledAnnotationBeanPostProcessor.

/**
 * Gets string value resolver.
 *
 * @param applicationContext the application context
 * @return the string value resolver
 */
public static StringValueResolver prepScheduledAnnotationBeanPostProcessor(final ApplicationContext applicationContext) {
    final StringValueResolver resolver = new CasEmbeddedValueResolver(applicationContext);
    final ScheduledAnnotationBeanPostProcessor sch = applicationContext.getBean(ScheduledAnnotationBeanPostProcessor.class);
    sch.setEmbeddedValueResolver(resolver);
    return resolver;
}
Also used : StringValueResolver(org.springframework.util.StringValueResolver) ScheduledAnnotationBeanPostProcessor(org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor) CasEmbeddedValueResolver(org.apereo.cas.CasEmbeddedValueResolver)

Example 4 with CasEmbeddedValueResolver

use of org.apereo.cas.CasEmbeddedValueResolver in project cas by apereo.

the class CasCoreUtilConfiguration method init.

@PostConstruct
public void init() {
    final ConfigurableApplicationContext ctx = applicationContextProvider().getConfigurableApplicationContext();
    final DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(true);
    conversionService.setEmbeddedValueResolver(new CasEmbeddedValueResolver(ctx));
    ctx.getEnvironment().setConversionService(conversionService);
    final ConfigurableEnvironment env = (ConfigurableEnvironment) ctx.getParent().getEnvironment();
    env.setConversionService(conversionService);
    final ConverterRegistry registry = (ConverterRegistry) DefaultConversionService.getSharedInstance();
    registry.addConverter(zonedDateTimeToStringConverter());
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) CasEmbeddedValueResolver(org.apereo.cas.CasEmbeddedValueResolver) ConfigurableEnvironment(org.springframework.core.env.ConfigurableEnvironment) ConverterRegistry(org.springframework.core.convert.converter.ConverterRegistry) DefaultFormattingConversionService(org.springframework.format.support.DefaultFormattingConversionService) PostConstruct(javax.annotation.PostConstruct)

Aggregations

CasEmbeddedValueResolver (org.apereo.cas.CasEmbeddedValueResolver)4 DefaultFormattingConversionService (org.springframework.format.support.DefaultFormattingConversionService)2 ScheduledAnnotationBeanPostProcessor (org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor)2 PostConstruct (javax.annotation.PostConstruct)1 BeanPostProcessor (org.springframework.beans.factory.config.BeanPostProcessor)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1 ConverterRegistry (org.springframework.core.convert.converter.ConverterRegistry)1 ConfigurableEnvironment (org.springframework.core.env.ConfigurableEnvironment)1 StringValueResolver (org.springframework.util.StringValueResolver)1