title: Ignore fields from specific request in Spring-boot
body: <p>i'm using Spring Boot REST Web Services and Angular 5 as a frontend, well i have model class for hibernate like this :</p>
  
  <pre><code>@Entity
  public class Title {
          private Integer id;
          private String name;
          private Date releaseDate;
          private Time runtime;
          private String storyline;
          private String picture;
          private String rated;
          private String type;
          private Double rating;
          private Integer numberOfVotes;
          private Timestamp inserted;
          private Set&lt;Genre&gt; genres = new HashSet&lt;&gt;();
          private List&lt;TitleCelebrity&gt; titleCelebrities;
          private List&lt;TitleMedia&gt; titleMedia;
  
          // Basic getters and setter
  
          @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
          @JoinTable(name = "title_genre", joinColumns = { @JoinColumn(name = "title_id") }, inverseJoinColumns = { @JoinColumn(name = "genre_id") })
          public Set&lt;Genre&gt; getGenres() {
              return genres;
          }
  
          public void setGenres(Set&lt;Genre&gt; genres) {
              this.genres = genres;
          }
  
          @OneToMany(mappedBy = "title", cascade = CascadeType.ALL)
          public List&lt;TitleCelebrity&gt; getTitleCelebrities() {
              return titleCelebrities;
          }
  
          public void setTitleCelebrities(List&lt;TitleCelebrity&gt; titleCelebrities) {
              this.titleCelebrities = titleCelebrities;
          }
  
          @OneToMany(mappedBy = "title", cascade = CascadeType.ALL)
          public List&lt;TitleMedia&gt; getTitleMedia() {
              return titleMedia;
          }
  
          public void setTitleMedia(List&lt;TitleMedia&gt; titleMedia) {
              this.titleMedia = titleMedia;
          }
      }
  </code></pre>
  
  <p>And here's my REST controller</p>
  
  <pre><code>@RestController
  @RequestMapping("titles")
  @CrossOrigin(origins = {"http://localhost:4200"})
  public class TitleController {
  
      private TitleService titleService;
  
      @Autowired
      public void setTitleService(TitleService titleService) {
          this.titleService = titleService;
      }
  
      // Api to get all the movies ordered by release date
      @GetMapping("movies")
      public List&lt;Title&gt; getAllMoviesOrderByReleaseDateDesc() {
          return this.titleService.findByTypeOrderByReleaseDateDesc("movie");
      }
  
      @GetMapping("movies/{id}")
      public Title findById(@PathVariable Integer id) {
          return this.titleService.findById(id);
      }
  
  }
  </code></pre>
  
  <p>What i want is when i make a request to the first method '/movies' i don't want the collection of titleMedia, but if i make a request to the second method '/movies/id' i want the collection of titleMedia.<br>
  of course the annotation <code>@JsonIgnore</code> will ignore the collection whatever the request is.</p>