cesardl/facultad-sample-app

View on GitHub
src/main/java/org/sanmarcux/Main.java

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
package org.sanmarcux;

import org.apache.log4j.Logger;
import org.sanmarcux.init.DatabaseConfig;
import org.sanmarcux.view.JFrameInit;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.swing.*;

/**
 * @author Cesardl
 */
public class Main {

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

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

            try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(DatabaseConfig.class)) {
                JFrameInit mainFrame = context.getBean(JFrameInit.class);

                javax.swing.SwingUtilities.invokeLater(() -> mainFrame.setVisible(true));
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
            LOG.error(e.getMessage(), e);
        }
    }
}