記錄此次失敗的錯誤,一警告自己以后做事情一定要仔細(xì),通讀全篇再開工?。。?!
//啟動時注入全局參數(shù)
@Configuration
//指定服務(wù)包
//@ComponentScan(basePackages = {"com.yt.design"})
@EnableJpaRepositories(basePackages = "com.yt.design.jpa.repository")
@EntityScan(basePackages = {"com.yt.design.jpa.entity"})
//指定啟動事務(wù)管理
@EnableTransactionManagement
public class JPAConfig {
。。。。。。
}
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory
(DataSource dataSource) {
LocalContainerEntityManagerFactoryBean em = new
LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
// TODO;2018年04月12日20:22:57教訓(xùn)仔細(xì)啊
em.setPackagesToScan("com.yt.design.jpa.entity");
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}