@Override
    public synchronized void onApplicationEvent(ContextRefreshedEvent event) {
        try {
            if (persistenceService.count(Beer.class) == 0) {
                CSVReader reader = new CSVReader(new FileReader(resource.getFile()));
                reader.readNext(); //skip first line with headers
                String[] beer;
                while ((beer = reader.readNext()) != null) {
                    try {
                        Beer persistentBeer = new Beer();
                        persistentBeer.setId(Long.parseLong(beer[0]));
                        persistentBeer.setName(beer[2]);
                        persistentBeer.setDescription(beer[10]);
                        persistentBeer.setAvb(Double.parseDouble(beer[5]));
                        if (!StringUtils.hasText(persistentBeer.getDescription())) {
                            continue;
                        }
                        persistenceService.create(persistentBeer);
                        logger.debug(String.format("imported: %s", persistentBeer.getName()));
                    } catch (Throwable t) {
                        logger.error("error importing beers", t.getMessage());
                    }
                }
                reader.close();
            }
        } catch (Exception ex) {
            logger.error("error importing beers", ex.getMessage());
        }
    }