org.springframework.data.repository.init.Jackson2RepositoryPopulatorFactoryBean Java Examples

The following examples show how to use org.springframework.data.repository.init.Jackson2RepositoryPopulatorFactoryBean. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PopulatorConfig.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Bean
public FactoryBean<ResourceReaderRepositoryPopulator> respositoryPopulator(
	ObjectMapper objectMapper, // <1>
	ResourceLoader resourceLoader) {

	Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean();
	factory.setMapper(objectMapper);
	factory.setResources(new Resource[] { resourceLoader.getResource("classpath:data.json") }); // <2>
	return factory;
}
 
Example #2
Source File: ApplicationConfiguration.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: MongoTestConfiguration.java    From spring-data-examples with Apache License 2.0 4 votes vote down vote up
public @Bean Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() {

		Jackson2RepositoryPopulatorFactoryBean factoryBean = new Jackson2RepositoryPopulatorFactoryBean();
		factoryBean.setResources(new Resource[] { new ClassPathResource("spring-blog.atom.json") });
		return factoryBean;
	}
 
Example #4
Source File: JpaPopulators.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public Jackson2RepositoryPopulatorFactoryBean getRespositoryPopulator() throws Exception {
    Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean();
    factory.setResources(new Resource[] { new ClassPathResource("fruit-data.json") });
    return factory;
}