Tive o erro ao acessar a base de dados, alterei no meu arquivo de propriedades para o endereço do Amazon, (não sei se está correto):
jdbc.url = jdbc:mysql://ec2-54-144-220-4.compute-1.amazonaws.com:3306/contas
Minha Classe SpringDataConfig Está assim:
package br.com.clipboard.financeiro.config;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaDialect;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableJpaRepositories("br.com.clipboard.financeiro.repository")
@EnableTransactionManagement
@PropertySource("classpath:/application.properties")
public class SpringDataConfig {
@Autowired
private Environment env;
@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory factory) {
JpaTransactionManager manager = new JpaTransactionManager();
manager.setEntityManagerFactory(factory);
manager.setJpaDialect(new HibernateJpaDialect());
return manager;
}
@Bean
public HibernateJpaVendorAdapter JpaVendorAdapter() {
HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
adapter.setShowSql(env.getProperty("hibernate.show.sql", Boolean.class));
adapter.setGenerateDdl(env.getProperty("hibernate.ddl", Boolean.class));
return adapter;
}
@Bean
public EntityManagerFactory entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(JpaVendorAdapter());
factory.setPackagesToScan(
env.getProperty("hibernate.package.scan"),
env.getProperty("java.time.jpa.converter")
);
factory.setDataSource(dataSource());
factory.afterPropertiesSet();
return factory.getObject();
}
@Bean(name = "dataSource")
public DataSource dataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUsername(env.getProperty("jdbc.user"));
dataSource.setPassword(env.getProperty("jdbc.pass"));
dataSource.setDriverClassName(env.getProperty("jdbc.driverClass"));
dataSource.setUrl(env.getProperty("jdbc.url"));
return dataSource;
}
}
e estou tendo o erro:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati ng bean with name 'entityManagerFactory' defined in class path resource [br/com/ clipboard/financeiro/config/SpringDataConfig.class]: Bean instantiation via fact ory method failed; nested exception is org.springframework.beans.BeanInstantiati onException: Failed to instantiate [javax.persistence.EntityManagerFactory]: Fac tory method 'entityManagerFactory' threw exception; nested exception is org.hibe rnate.HibernateException: Access to DialectResolutionInfo cannot be null when 'h ibernate.dialect' not set
Qual o caminho da base de dados correta? Onde estou errando aqui?