packagesToScan
で注釈を付けて保持したいクラスを含むパッケージ(たとえば)があり@Entity
ます。
構成を定義している間ApplicationContext
、私は次のようにしました。
@Configuration
@EnableJpaRepositories("packagesToScan")
@EnableTransactionManagement
@PropertySource("server/jdbc.properties")
@ComponentScan("packagesToScan")
public class JpaContext {
...
// Other configurations
....
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(this.dataSource());
emf.setJpaVendorAdapter(this.jpaVendorAdapter());
emf.setPackagesToScan("packagesToScan");
emf.setJpaProperties(this.hibernateProperties());
return emf;
}
packagesToScan
開発中に、永続化の要件 (主キーがないなど) を満たさないクラスがいくつかあります。このため、ApplicationContext
セットアップの失敗のためにテストを実行できません。
さて、
選択したいくつかのクラスだけをスキャンしたり、 内のいくつかのクラスを無視したりする方法はありますpackagesToScan
か?