Here is a simple way to get RESTEasy links to resolve UEL variable as
Spring beans (supposing there is only one Spring ApplicationContext) :

@Component
public class SpringELProvider implements ELProvider,
ApplicationContextAware {

    private static ApplicationContext applicationContext;

    @Override
    public ELContext getContext(final ELContext ctx) {
        final SimpleSpringBeanELResolver elr = new
SimpleSpringBeanELResolver(applicationContext);
        return new ELContext() {

            @Override
            public VariableMapper getVariableMapper() {
                return ctx.getVariableMapper();
            }

            @Override
            public FunctionMapper getFunctionMapper() {
                return ctx.getFunctionMapper();
            }

            @Override
            public ELResolver getELResolver() {
                CompositeELResolver cer = new CompositeELResolver();
                cer.add(elr);
                cer.add(ctx.getELResolver());
                return cer;
            }
        };
    }

    @Override
    public void setApplicationContext(ApplicationContext
applicationContext) throws BeansException {
        SpringELProvider.applicationContext = applicationContext;
    }

}

Also add a <bean class="org.company.resteasy.SpringELProvider " /> in the
Spring application-context to initialize the ELProvider static variable.

Maybe it could be added to documentation (Extending the UEL context - as
the Seam sample) ?
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to