Version 3

    This coalesces all the configuration needed to get your RESTEasy-annotated classes to work with Spring.  The short list of what you need to do:


    1. Set up your project dependencies
    2. Configure Spring in web.xml
    3. Make sure RESTEasy configuration in web.xml doesn't interfere with what you are doing
    4. Configure your Spring beans


    (The last two steps took me a while to figure out)


    Set up your project dependencies


    For maven users add:



    Full example pom here


    Configure Spring in web.xml

    This is more or less what the official docs say:




    The order is important.  Full example web.xml here


    Make RESTEasy configuration not interfere


    It's crucial that you do not configure resteasy.scan or resteasy.resources.  This will result in strange behavior; sometimes the beans created by Spring will be used by RESTEasy and sometimes RESTEasy will create its own.  So, don't configure your RESTEasy-annotated classes via RESTEasy's context params (I would assume implementing to expose your classes would also cause these weird problems)


    The example web.xml contains scant configuration, and just be warned.


    Configure your Spring beans


    I was unable to get any auto-wiring to work, so you will need to configure your RESTEasy-annotated classes in your spring configuration (which, for web-apps, defaults to applicationContext.xml)



    <?xml version="1.0" encoding="utf-8"?>
    <beans xmlns=""
      <import resource="other-spring-stuff.xml" />
      <bean id="servicePoint"
        <property name="service"><ref bean="service" /></property>


    Note here, I'm injecting the bean service (which I've defined elsewhere); whatever beans you want, inject them here as normal (again, I wasn't able to get auto-wiring to work [but I'm not a fan of it anyway]).


    My class looks like so:



    package com.example;
    import java.util.List;
    import javax.annotation.Resource;
    import com.example.Service;
     * Service Point endpoint.
     * @author dave.copeland
    public class ServicePoint {
        private Service service;
        public String getDailyReads(@PathParam("meter_id") String meterId){
            if (this.service == null) {
                throw new IllegalStateException("service didn't get injected");
            List<Long> reads = this.service.getReads(meterId);
            StringBuilder b = new StringBuilder("date,val\n");
            for (Long read: reads) {
            return b.toString();
        public void setService(Service service) {
            this.service = service;

    Other Caveats


    If you cannot get RESTEasy to recognize your Spring beans as REST resources, you need to add the following lines to your Spring configuration files.  This is not mentioned in the documentation and it took this contributor (benw) over a day to figure this out.


       <context:component-scan base-package="com.example"/>