title: RepositoryRestResource with spring-boot CLI
body: <p>I'm trying to implement a simple REST service based on a JPA repository with spring-boot and spring-data-rest. (see this <a href="http://spring.io/guides/gs/accessing-data-rest/" rel="nofollow">tutorial</a>) The following code works quite well if a use it with gradle:</p>
  
  <pre><code>package ch.bfh.swos.bookapp
  
  import org.springframework.boot.SpringApplication
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration
  import org.springframework.context.annotation.*
  import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories
  import org.springframework.context.annotation.Import
  import org.springframework.data.rest.core.annotation.RepositoryRestResource
  import org.springframework.data.repository.CrudRepository
  import javax.persistence.*
  
  @Configuration
  @ComponentScan
  @EnableAutoConfiguration
  @EnableJpaRepositories
  @Import(RepositoryRestMvcConfiguration.class)
  class Application {
      static void main(String[] args) {
          SpringApplication.run Application, args
      }
  }
  
  @RepositoryRestResource(path = "authors")
  interface AuthorRepository extends CrudRepository&lt;Author, Long&gt; {}
  
  @Entity
  class Author {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id
      private String firstname
      private String lastname
  }
  </code></pre>
  
  <p>To make things even simpler i tried the same code with the spring boot CLI ("spring run" command). </p>
  
  <pre><code>package ch.bfh.swos.bookapp
  
  @Grab("spring-boot-starter-data-jpa")
  @Grab("spring-boot-starter-data-rest")
  @Grab("h2")
  
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration
  import org.springframework.context.annotation.ComponentScan
  import org.springframework.context.annotation.Configuration
  import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories
  import org.springframework.context.annotation.Import
  
  import org.springframework.data.rest.core.annotation.RepositoryRestResource
  import org.springframework.data.repository.CrudRepository
  
  import javax.persistence.*
  
  @Configuration
  @ComponentScan
  @EnableAutoConfiguration
  @EnableJpaRepositories
  @Import(RepositoryRestMvcConfiguration.class)
  @RepositoryRestResource(path = "authors")
  interface AuthorRepository extends CrudRepository&lt;Author, Long&gt; {}
  
  @Entity
  class Author {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id
      private String firstname
      private String lastname
  }
  </code></pre>
  
  <p>Unfortunately this does not seem to work. @RepositoryRestResource seems not to be automatically recognized like e.g. @RestController.
  Leaving the @Configuration part in, the server starts up, but the REST repository is not created as if it would with gradle.</p>
  
  <p>Does anybody know if it is possible to create a RepositoryRestResource with the spring-boot CLI and how the correct code should look like?  </p>