All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oath.micro.server.spring.boot.BootApplicationConfigurator Maven / Gradle / Ivy

There is a newer version: 1.2.6
Show newest version
package com.oath.micro.server.spring.boot;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import cyclops.reactive.ReactiveSeq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;

import com.oath.micro.server.config.Config;
import com.oath.micro.server.spring.SpringBuilder;

public class BootApplicationConfigurator implements SpringBuilder {
	private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	public ConfigurableApplicationContext createSpringApp(Config config, Class...classes)  {
		
		
		List classList = new ArrayList();
		classList.addAll(Arrays.asList(classes));
		classList.add(JerseyApplication.class);
		SpringApplicationBuilder builder = new SpringApplicationBuilder(classList.toArray(new Class[0]));
		new JerseyApplication(classList).config(builder);
		
		return builder.application().run();
	}

    @Override
    public Class[] classes(Config config, Class... classes) {
        List classList = new ArrayList();
        classList.addAll(Arrays.asList(classes));
        return ReactiveSeq.fromIterable(new JerseyApplication(classList).classes).appendAll(classList)
                        .toArray(i->new Class[i]);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy