org.kuali.coeus.s2sgen.impl.generate.GeneratorInitializerImpl.java Source code

Java tutorial

Introduction

Here is the source code for org.kuali.coeus.s2sgen.impl.generate.GeneratorInitializerImpl.java

Source

/*
 * Kuali Coeus, a comprehensive research administration system for higher education.
 * 
 * Copyright 2005-2016 Kuali, Inc.
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.kuali.coeus.s2sgen.impl.generate;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component("generatorInitializer")
public class GeneratorInitializerImpl implements GeneratorInitializer, ApplicationContextAware, InitializingBean {

    private static final Logger LOG = LoggerFactory.getLogger(GeneratorInitializerImpl.class);

    private ApplicationContext applicationContext;

    @Override
    public void initialize() {
        final Map<String, S2SFormGenerator> map = applicationContext.getBeansOfType(S2SFormGenerator.class);
        LOG.info("Found the following generators: " + map.keySet());
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        initialize();
    }
}