In the tutorial do this:
TopicController
@RestController public class TopicController { @RequestMapping("/topics") public List<Topic> getAllTopics(){ return Arrays.asList( new Topic("spring", "Spring Framework", "Spring Framework Description"), new Topic("java", "Core Java", "Core Java Description"), new Topic("javascript", "Javascript", "Javascript Description") ); } } Topic
package com.in.controller; public class Topic { private String id; private String name; private String description; public Topic(){ } public Topic(String id, String name, String description) { this.id = id; this.name = name; this.description = description; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } } Why do we do like this through Arrays.asList ()?
Where does Arrays come from?
So that it can call asList ()?
Where is he?))
return Arrays.asList(new Topic("spring", "Spring Framework", "Spring Framework Description"), new Topic("java", "Core Java", "Core Java Description"), new Topic("javascript", "Javascript", "Javascript Description") As I understand Arrays.asList, we represent an array in the form of a list, but I do not see an array in this example.
But if you remove Arrays.asList and leave it simple:
@RequestMapping("/topics") public List<Topic> getAllTopics(){ return new Topic("spring", "Spring Framework", "Spring Framework Description"); new Topic("java", "Core Java", "Core Java Description"), new Topic("javascript", "Javascript", "Javascript Description") ); That compiler swears and says:

Arrays.asList? What exactly is not clear to you with this method? - default locale