package com.libreecm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;

import com.libreecm.commonAPI.configuration.ComponentConfig;

@SpringBootApplication
public class Application extends SpringBootServletInitializer {

	//private static final Logger log = LoggerFactory.getLogger(Application.class);
	


	@Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  			return application.sources(Application.class); 
    }
	
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return (container -> {
            container.setPort(ComponentConfig.getConfig().getLibreECMLocalPort());
        });
    }
    
  
}


