Estou usando a versão mais recente do MySQL 8 e ao iniciar o servidor recebo o erro abaixo:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EntityManagerFactory' defined in class br.com.casadocodigo.loja.conf.JPAConfigurator: Invocation of init method failed; nested exception is org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.MySQL8Dialect] as strategy [org.hibernate.dialect.Dialect]
Segue a classe JPAConfigurator:
public class JPAConfigurator {
@Bean
public LocalContainerEntityManagerFactoryBean EntityManagerFactory() {
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
JpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
factoryBean.setJpaVendorAdapter(adapter);
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUsername("root");
dataSource.setPassword("");
dataSource.setUrl("jdbc:mysql://localhost:3303/casadocodigo");
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
factoryBean.setDataSource(dataSource);
Properties props = new Properties();
props.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL8Dialect");
props.setProperty("hibernate.show_sql", "true");
props.setProperty("hibernate.hbm2ddl.auto", "update");
factoryBean.setJpaProperties(props);
factoryBean.setPackagesToScan("br.com.casadocodigo.loja.models");
return factoryBean;
}
}