Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Application properties:
- # DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
- spring.datasource.driver-class-name = com.mysql.jdbc.Driver
- spring.datasource.url = jdbc:mysql://localhost:3306/post
- spring.datasource.sql-script-encoding=UTF-8
- spring.datasource.username = *******
- spring.datasource.password = *******
- # JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
- spring.jpa.database-platform = org.hibernate.dialect.MySQLDialect
- spring.jpa.hibernate.hbm2ddl.auto = create
- spring.jpa.generate-ddl = true
- spring.jpa.show-sql = false
- @Bean
- public LocalContainerEntityManagerFactoryBean em(DataSource
- source,JpaVendorAdapter adapter) {
- Properties properties = new Properties();
- properties.setProperty("hibernate.hbm2ddl.auto", "create");
- LocalContainerEntityManagerFactoryBean em
- = new LocalContainerEntityManagerFactoryBean();
- em.setDataSource(source);
- em.setPackagesToScan("*******");
- em.setJpaVendorAdapter(adapter);
- em.setJpaProperties(properties);
- return em;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement