witam, chciałem pobierać resta z api/news/getNews ale ciągle dostaję 404 not found. Od godziny próbuję znaleźć błąd i nie mam pojęcia co może być przyczyną Próbowałem wyświetlać cokolwiek, jakiś komunikat w konsoli ale wg nie wywołuje tej funkcji findAll:/ Wstawiam kod controllera i klasy rozruchowej
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@EnableAutoConfiguration
@ComponentScan
@Configuration
public class Angular2Application {
public static void main(String[] args) {
SpringApplication.run(Angular2Application.class, args);
}
}
package rest;
import java.util.List;
import model.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import service.CommentService;
import service.NewsService;
@RestController
@RequestMapping("/api/news")
public class AppRestController {
private final CommentService commentService;
private final NewsService newsService;
@Autowired
public AppRestController(CommentService cs, NewsService ns){
this.commentService = cs;
this.newsService = ns;
}
@RequestMapping(method = RequestMethod.GET, value="/getNews")
public @ResponseBody List<News> findAll(){
return newsService.getObj();
}
}