From bebe7c159f00e6d5a83bb786824d5f32e4de9270 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 24 Feb 2018 16:54:28 +0300
Subject: spring boot wip
---
.../server/configuration/ApiAppConfiguration.java | 34 +-----------
.../juick/server/configuration/ApiInitializer.java | 64 ----------------------
.../configuration/ApiSecurityInitializer.java | 38 -------------
3 files changed, 2 insertions(+), 134 deletions(-)
delete mode 100644 juick-server/src/main/java/com/juick/server/configuration/ApiInitializer.java
delete mode 100644 juick-server/src/main/java/com/juick/server/configuration/ApiSecurityInitializer.java
(limited to 'juick-server/src/main/java/com/juick/server/configuration')
diff --git a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
index 146e277c..65a9d410 100644
--- a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java
@@ -17,18 +17,15 @@
package com.juick.server.configuration;
+import com.juick.configuration.DataConfiguration;
import com.juick.server.WebsocketManager;
import com.juick.server.api.rss.MessagesView;
import com.juick.server.api.rss.RepliesView;
import com.juick.server.component.JuickServerComponent;
import com.juick.server.component.JuickServerReconnectManager;
import com.juick.service.UserService;
-import com.juick.server.xmpp.helpers.JidConverter;
-import com.juick.server.xmpp.s2s.BasicXmppSession;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
@@ -43,9 +40,6 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
import org.springframework.web.util.UriComponentsBuilder;
-import rocks.xmpp.core.session.Extension;
-import rocks.xmpp.core.session.XmppSessionConfiguration;
-import rocks.xmpp.core.session.debug.LogbackDebugger;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
@@ -56,19 +50,16 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.Collections;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
/**
* Created by aalexeev on 11/12/16.
*/
@Configuration
@EnableAsync
-@EnableWebMvc
@EnableSwagger2
@EnableScheduling
@EnableWebSocket
-@PropertySource(value = "classpath:juick.conf", ignoreResourceNotFound = true)
+@Import({ApiSecurityConfig.class, DataConfiguration.class, StorageConfiguration.class})
@ComponentScan(basePackages = "com.juick.server")
public class ApiAppConfiguration extends BaseWebConfiguration implements WebSocketConfigurer {
@Inject
@@ -132,27 +123,6 @@ public class ApiAppConfiguration extends BaseWebConfiguration implements WebSock
container.setMaxBinaryMessageBufferSize(8192);
return container;
}
- @Value("${hostname:localhost}")
- private String hostname;
-
- @Bean
- public ExecutorService service() {
- return Executors.newCachedThreadPool();
- }
- @Bean
- public BasicXmppSession session() {
- XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
- .extensions(Extension.of(com.juick.Message.class))
- .debugger(LogbackDebugger.class)
- .build();
- return BasicXmppSession.create(hostname, configuration);
- }
- @Bean
- public static ConversionService conversionService() {
- DefaultFormattingConversionService cs = new DefaultFormattingConversionService();
- cs.addConverter(new JidConverter());
- return cs;
- }
@Bean
public BeanNameViewResolver beanNameViewResolver() {
return new BeanNameViewResolver();
diff --git a/juick-server/src/main/java/com/juick/server/configuration/ApiInitializer.java b/juick-server/src/main/java/com/juick/server/configuration/ApiInitializer.java
deleted file mode 100644
index b789fc50..00000000
--- a/juick-server/src/main/java/com/juick/server/configuration/ApiInitializer.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.server.configuration;
-
-import com.juick.configuration.DataConfiguration;
-import org.apache.commons.codec.CharEncoding;
-import org.springframework.web.filter.CharacterEncodingFilter;
-import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
-
-import javax.annotation.Nonnull;
-import javax.servlet.Filter;
-
-/**
- * Created by vt on 09/02/16.
- */
-public class ApiInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
-
- @Override
- protected Class>[] getRootConfigClasses() {
- return new Class>[]{
- ApiAppConfiguration.class,
- ApiSecurityConfig.class,
- DataConfiguration.class,
- StorageConfiguration.class
- };
- }
-
- @Override
- protected Class>[] getServletConfigClasses() {
- return null;
- }
-
- @Override
- @Nonnull
- protected String[] getServletMappings() {
- return new String[]{"/"};
- }
-
- @Override
- protected Filter[] getServletFilters() {
- return new Filter[]{new CharacterEncodingFilter(CharEncoding.UTF_8)};
- }
-
- @Override
- @Nonnull
- protected String getServletName() {
- return "API dispatcher servlet";
- }
-}
diff --git a/juick-server/src/main/java/com/juick/server/configuration/ApiSecurityInitializer.java b/juick-server/src/main/java/com/juick/server/configuration/ApiSecurityInitializer.java
deleted file mode 100644
index ece023fc..00000000
--- a/juick-server/src/main/java/com/juick/server/configuration/ApiSecurityInitializer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.server.configuration;
-
-/**
- * - * Created by vitalyster on 25.11.2016.
- * -
- */
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
-
-import javax.servlet.ServletContext;
-
-public class ApiSecurityInitializer extends AbstractSecurityWebApplicationInitializer {
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
- @Override
- protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
- logger.info("SpringSecurityFilterChain initialized");
- }
-}
\ No newline at end of file
--
cgit v1.2.3