Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ProjetoRua.com.projetorua;
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- @SpringBootApplication
- public class Application {
- public static void main(String[] args) {
- SpringApplication.run(Application.class, args);
- }
- }
- package ProjetoRua.com.projetorua;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.context.annotation.Profile;
- import org.springframework.jdbc.datasource.DriverManagerDataSource;
- import org.springframework.orm.jpa.JpaVendorAdapter;
- import org.springframework.orm.jpa.vendor.Database;
- import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
- import javax.sql.DataSource;
- @Configuration
- @Profile("dev")
- public class DataConfiguration {
- @Bean
- public DataSource dataSource(){
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
- dataSource.setDriverClassName("com.mysql.jdbc.Driver");
- dataSource.setUrl("jdbc:mysql://localhost:63342/projetorua");
- dataSource.setUsername("root");
- dataSource.setPassword("123456");
- return dataSource;
- }
- @Bean
- public JpaVendorAdapter jpaVendorAdapter(){
- HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
- adapter.setDatabase(Database.MYSQL);
- adapter.setShowSql(true);
- adapter.setGenerateDdl(true);
- adapter.setDatabasePlatform("org.hibernate.dialect.MySQLDialect");
- adapter.setPrepareConnection(true);
- return adapter;
- }
- }
Add Comment
Please, Sign In to add comment