I have two controllers.
I wrote this controllers and where i have to write config to correct work.
@Controller
public class BookController {
private BookService bookService;
@Autowired(required = true)
@Qualifier(value = "bookService")
public void setBookService(BookService bookService) {
this.bookService = bookService;
}
@RequestMapping(value = "books", method = RequestMethod.GET)
public String listBooks(Model model){
model.addAttribute("book", new Book());
model.addAttribute("listBooks", this.bookService.listBooks());
return "books";
}
}
@Controller("controller1")
public class AuthorController {
private AuthorService authorService;
@Autowired(required = true)
@Qualifier(value = "authorService")
public void setBookService(AuthorService authorService) {
this.authorService = authorService;
}
@RequestMapping
(value = "authors", method = RequestMethod.GET)
public String listAuthors(Model model){
model.addAttribute("author", new Author());
model.addAttribute("listAuthors", this.authorService.list());
return "";
}
}