1 package de.spring.example.rest.controllers;
3 import javax.inject.Inject;
5 import org.resthub.web.controller.RepositoryBasedRestController;
6 import org.springframework.web.bind.annotation.RequestMapping;
7 import org.springframework.web.bind.annotation.RestController;
9 import de.spring.example.persistence.domain.Ad;
10 import de.spring.example.persistence.repository.AdRepository;
13 @RequestMapping("/ads/")
14 public class AdController extends RepositoryBasedRestController<Ad, Long, AdRepository> {
18 public void setRepository(AdRepository repository) {
19 this.repository = repository;
22 // I do not have to do anything here because all I need is implemented by RepositoryBasedRestController :)
24 // @Transactional is implemented by org.springframework.data.jpa.repository.support.SimpleJpaRepository
25 // By default, SimpleJpaRepository will be automatically implemented by my
26 // Spring JPA repositories: AdRepository and AdDescriptionRepository.