Commit a17c7ffe authored by Matija Obreza's avatar Matija Obreza
Browse files

Reorganized packages for improved application WebConfiguration

parent d2be7b47
......@@ -40,6 +40,7 @@ import org.springframework.core.io.Resource;
public class ApplicationConfig {
@Bean
@Order(Integer.MIN_VALUE)
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
final PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
propertyPlaceholderConfigurer.setIgnoreResourceNotFound(true);
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.catalog.server.components;
package org.genesys.catalog.server.config;
import javax.transaction.Transactional;
......
......@@ -19,8 +19,7 @@ import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import org.genesys.catalog.server.components.AddStuffInterceptor;
import org.genesys.catalog.server.components.StartupInitializer;
import org.genesys.catalog.server.controller.AddStuffInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
......@@ -57,7 +56,7 @@ import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
*/
@Configuration
@EnableWebMvc
@ComponentScan({ "org.genesys.catalog.server" })
@ComponentScan({ "org.genesys.catalog.server.controller", "org.genesys.catalog.server.service" })
public class WebConfiguration extends WebMvcConfigurerAdapter {
@Override
......@@ -120,11 +119,6 @@ public class WebConfiguration extends WebMvcConfigurerAdapter {
return new AddStuffInterceptor();
}
@Bean
public StartupInitializer startupInitializer() {
return new StartupInitializer();
}
@Override
public void addInterceptors(final InterceptorRegistry registry) {
final LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.catalog.server.components;
package org.genesys.catalog.server.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......
......@@ -18,21 +18,13 @@ package org.genesys.catalog.server.controller.rest;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
import org.genesys.blocks.oauth.service.OAuthClientDetailsService;
import org.genesys.blocks.oauth.service.OAuthServiceImpl;
import org.genesys.catalog.server.config.SwaggerConfig;
import org.genesys.catalog.server.controller.api.v0.DatasetCreatorController;
import org.genesys.catalog.server.controller.api.v0.DescriptorController;
import org.genesys.catalog.server.controller.api.v0.GeoController;
import org.genesys.catalog.server.controller.api.v0.LocationController;
import org.genesys.catalog.server.controller.api.v0.PartnerController;
import org.genesys.catalog.server.controller.api.v0.PermissionController;
import org.genesys.catalog.server.controller.DescriptorListExporter;
import org.genesys.catalog.server.controller.api.v0.ApiInfoController;
import org.genesys.catalog.server.service.FreemarkerTemplating;
import org.genesys.catalog.server.service.impl.FreemarkerTemplatingServiceImpl;
import org.genesys.catalog.server.tests.ServiceTest;
import org.junit.Rule;
import org.junit.runner.RunWith;
......@@ -54,6 +46,12 @@ import org.springframework.web.servlet.config.annotation.ContentNegotiationConfi
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
/**
* @author Matija Obreza.
* @author Andrey Lugovskoy.
......@@ -80,15 +78,25 @@ public abstract class AbstractRestTest extends ServiceTest {
@Configuration
@EnableWebMvc
@Import(SwaggerConfig.class)
@ComponentScan(basePackageClasses = { DescriptorController.class, PartnerController.class, DatasetCreatorController.class,
LocationController.class, PermissionController.class, GeoController.class})
// Only import controller.api package
@ComponentScan(basePackageClasses = { ApiInfoController.class })
@DirtiesContext(hierarchyMode = HierarchyMode.CURRENT_LEVEL, classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public static class Config extends WebMvcConfigurerAdapter {
@Bean
public OAuthClientDetailsService oAuthClientDetailsService() {
return new OAuthServiceImpl();
}
@Bean
public OAuthClientDetailsService oAuthClientDetailsService() {
return new OAuthServiceImpl();
}
@Bean
public DescriptorListExporter descriptorListExporter() {
return new DescriptorListExporter();
}
@Bean
public FreemarkerTemplating freemarkerTemplating() {
return new FreemarkerTemplatingServiceImpl();
}
public MappingJackson2HttpMessageConverter jacksonMessageConverter() {
final MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment