aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java
blob: 6ceb140bdc9cbeaf7d008b40cabcb0b68e2a5d54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.juick.www.configuration;

import com.juick.server.configuration.PostConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnClass(name = "com.juick.server.api.Post")
public class EmbeddedAPIConfig {
    @Bean
    public ConfigurableApplicationContext apiContext() {
        return new SpringApplicationBuilder()
                .sources(PostConfig.class)
                .run("--server.port=8081");
    }
}