Ao tentar executar a classe Configuration, estou recebendo essa Exceção:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-08-28 22:41:43.854 ERROR 17667 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field aRepository in vipList.config.controllers.ConvidadosController required a bean of type 'vipList.model.repository.ConvidadoRepository' that could not be found.
Action:
Consider defining a bean of type 'vipList.model.repository.ConvidadoRepository' in your configuration.
``
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-08-28 22:41:43.854 ERROR 17667 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field aRepository in vipList.config.controllers.ConvidadosController required a bean of type 'vipList.model.repository.ConvidadoRepository' that could not be found.
Action:
Consider defining a bean of type 'vipList.model.repository.ConvidadoRepository' in your configuration.
Seguem as Classes:
Controlador
package vipList.config.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import vipList.model.entities.Convidado;
import vipList.model.repository.ConvidadoRepository;
@Controller
public class ConvidadosController {
private static final String SLASH = "/";
private static final String LISTA_CONVIDADOS = "listaConvidados";
private static final String INDEX = "index";
@Autowired
private ConvidadoRepository aRepository;
@RequestMapping(SLASH)
public String getIndexPage() {
return INDEX;
}
@RequestMapping(SLASH + LISTA_CONVIDADOS)
public String getListaConvidados(Model pModel) {
Iterable<Convidado> iterableConvidados = this.aRepository.findAll();
pModel.addAttribute(iterableConvidados);
return LISTA_CONVIDADOS;
}
}
Segue a classe de Configuração:
package vipList.config;
import javax.sql.DataSource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import vipList.model.repository.ConvidadoRepository;
@SpringBootApplication
public class Configuration {
private static final String ROOT_PASSWORD = "RootPassword";
private static final String ROOT_USER = "root";
private static final String MY_VIP_LIST_DATABASE = "myviplist";
private static final String JDBC_MYSQL_LOCALHOST_3306 = "jdbc:mysql://localhost:3306/";
private static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver";
@Bean
public DataSource getDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName( COM_MYSQL_JDBC_DRIVER);
dataSource.setUrl( JDBC_MYSQL_LOCALHOST_3306 + MY_VIP_LIST_DATABASE);
dataSource.setUsername( ROOT_USER);
dataSource.setPassword( ROOT_PASSWORD);
return dataSource;
}
public static void main(String[] args) {
SpringApplication.run(Configuration.class, args);
}
}
Onde eu estou errando?