diff options
-rw-r--r-- | juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java | 7 | ||||
-rw-r--r-- | juick-server-web/src/main/java/com/juick/server/configuration/JuickServerComponentConfiguration.java | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java index 828f8cbd..388fda67 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java @@ -21,10 +21,7 @@ import com.juick.api.ApiServer; import com.juick.server.component.JuickServerComponent; import com.juick.server.component.JuickServerReconnectManager; import com.juick.server.configuration.BaseWebConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.*; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; @@ -47,10 +44,12 @@ import java.util.Collections; @PropertySource("classpath:juick.conf") @ComponentScan(basePackages = "com.juick") public class ApiAppConfiguration extends BaseWebConfiguration { + @Lazy @Bean public JuickServerComponent juickServerComponent() { return new JuickServerComponent(); } + @Lazy @Bean public JuickServerReconnectManager juickServerReconnectManager() { return new JuickServerReconnectManager(); diff --git a/juick-server-web/src/main/java/com/juick/server/configuration/JuickServerComponentConfiguration.java b/juick-server-web/src/main/java/com/juick/server/configuration/JuickServerComponentConfiguration.java index 23f550a5..a2df26fc 100644 --- a/juick-server-web/src/main/java/com/juick/server/configuration/JuickServerComponentConfiguration.java +++ b/juick-server-web/src/main/java/com/juick/server/configuration/JuickServerComponentConfiguration.java @@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -25,6 +26,7 @@ import java.io.IOException; import java.util.Collections; import java.util.List; +@Lazy @Configuration @EnableScheduling public class JuickServerComponentConfiguration { |