Код: Выделить всё
import com.abhishek.demo2.entity.Question;
import com.abhishek.demo2.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/question")
public class QuestionController
{
QuestionService questionService;
@Autowired
public QuestionController(QuestionService questionService)
{
this.questionService = questionService;
}
@GetMapping("/all")
public List getAllQuestions()
{
return questionService.getAllQuestions();
}
}
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/776 ... pring-boot