Java 类org.springframework.data.repository.init.Jackson2RepositoryPopulatorFactoryBean 实例源码

项目:spring-data-examples    文件:ApplicationConfiguration.java   
/**
 * Read JSON data from disk and insert those stores.
 * 
 * @return
 */
public @Bean AbstractRepositoryPopulatorFactoryBean repositoryPopulator() {

    ObjectMapper mapper = new ObjectMapper();
    mapper.addMixIn(GeoJsonPoint.class, GeoJsonPointMixin.class);
    mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);

    Jackson2RepositoryPopulatorFactoryBean factoryBean = new Jackson2RepositoryPopulatorFactoryBean();
    factoryBean.setResources(new Resource[] { new ClassPathResource("starbucks-in-nyc.json") });
    factoryBean.setMapper(mapper);

    return factoryBean;
}
项目:spring-data-demo    文件:AppConfig.java   
@Bean
public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() {
    Resource sourceData = new ClassPathResource("data.json");
    Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean();
    factory.setResources(new Resource[]{sourceData});
    return factory;
}
项目:spring-data-examples    文件:MongoTestConfiguration.java   
public @Bean Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() {

        Jackson2RepositoryPopulatorFactoryBean factoryBean = new Jackson2RepositoryPopulatorFactoryBean();
        factoryBean.setResources(new Resource[] { new ClassPathResource("spring-blog.atom.json") });
        return factoryBean;
    }