/** * 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; }
@Bean public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { Resource sourceData = new ClassPathResource("data.json"); Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean(); factory.setResources(new Resource[]{sourceData}); return factory; }
public @Bean Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() { Jackson2RepositoryPopulatorFactoryBean factoryBean = new Jackson2RepositoryPopulatorFactoryBean(); factoryBean.setResources(new Resource[] { new ClassPathResource("spring-blog.atom.json") }); return factoryBean; }