net.sf.gazpachoquest.repository.dynamic.QuestionnaireAnswersActivator.java Source code

Java tutorial

Introduction

Here is the source code for net.sf.gazpachoquest.repository.dynamic.QuestionnaireAnswersActivator.java

Source

/*******************************************************************************
 * Copyright (c) 2014 antoniomariasanchez at gmail.com.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     antoniomaria - initial API and implementation
 ******************************************************************************/
package net.sf.gazpachoquest.repository.dynamic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class QuestionnaireAnswersActivator implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    private QuestionnaireAnswersRepository repository;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent arg0) {
        repository.activeAllAnswers();
    }
}