Prezados, boa tarde!
Estou com problemas com meu data source. Eu entendi que tem algo a ver com incompatibilidade, mas não sei do que . Quando vou subir o servidor está dando o seguinte erro:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in br.com.alura.listavip.Configuracao: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0
Minha classe de configuração:
package br.com.alura.listavip;
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;
@SpringBootApplication
public class Configuracao {
public static void main(String[] args) {
SpringApplication.run(Configuracao.class, args);
}
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/listavip");
dataSource.setUsername("root");
dataSource.setPassword("q1w2e3r4");
return dataSource;
}
}
Meu controller:
package br.com.alura.listavip;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import br.com.alura.listavip.modelo.Convidado;
import br.com.alura.listavip.repository.ConvidadoRepository;
@Controller
public class ConvidadoController {
@Autowired
private ConvidadoRepository repository;
@RequestMapping("/")
public String index() {
return "index";
}
@RequestMapping("listaConvidados")
public String listaConvidados(Model model) {
Iterable<Convidado> convidados = repository.findAll();
model.addAttribute("convidados", convidados);
return "listaConvidados";
}
Se alguém puder me ajudar, eu agradeço!
Att Rodrigo