aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java
new file mode 100644
index 00000000..6ceb140b
--- /dev/null
+++ b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java
@@ -0,0 +1,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");
+ }
+}