Subversion Repositories SmartDukaan

Rev

Rev 28584 | Rev 28586 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28584 Rev 28585
Line 1... Line 1...
1
package com.spice.profitmandi.web.config;
1
package com.spice.profitmandi.web.config;
2
 
2
 
3
import java.util.List;
3
import java.util.List;
4
 
4
 
-
 
5
import javax.xml.transform.Source;
-
 
6
 
5
import org.apache.logging.log4j.LogManager;
7
import org.apache.logging.log4j.LogManager;
6
import org.apache.logging.log4j.Logger;
8
import org.apache.logging.log4j.Logger;
7
import org.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.context.annotation.Bean;
10
import org.springframework.context.annotation.Bean;
9
import org.springframework.context.annotation.ComponentScan;
11
import org.springframework.context.annotation.ComponentScan;
10
import org.springframework.context.annotation.Configuration;
12
import org.springframework.context.annotation.Configuration;
11
import org.springframework.http.MediaType;
13
import org.springframework.http.MediaType;
-
 
14
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
12
import org.springframework.http.converter.HttpMessageConverter;
15
import org.springframework.http.converter.HttpMessageConverter;
-
 
16
import org.springframework.http.converter.ResourceHttpMessageConverter;
13
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
17
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-
 
18
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
-
 
19
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
14
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
20
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
15
import org.springframework.web.servlet.config.annotation.CorsRegistry;
21
import org.springframework.web.servlet.config.annotation.CorsRegistry;
16
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
22
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
17
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
23
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
18
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
24
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
19
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
25
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
20
 
26
 
21
import com.fasterxml.jackson.databind.DeserializationFeature;
27
import com.fasterxml.jackson.databind.DeserializationFeature;
22
import com.fasterxml.jackson.databind.ObjectMapper;
28
import com.fasterxml.jackson.databind.ObjectMapper;
23
import com.fasterxml.jackson.databind.SerializationFeature;
29
import com.fasterxml.jackson.databind.SerializationFeature;
24
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
30
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
Line 35... Line 41...
35
 
41
 
36
@Configuration
42
@Configuration
37
@EnableWebMvc
43
@EnableWebMvc
38
@EnableSwagger2
44
@EnableSwagger2
39
@ComponentScan("com.spice.profitmandi.*")
45
@ComponentScan("com.spice.profitmandi.*")
40
public class WebMVCConfig extends WebMvcConfigurationSupport {
46
public class WebMVCConfig extends WebMvcConfigurerAdapter {
41
 
47
 
42
	private static final String RESOURCES_PATTERN = "/resources/**";
48
	private static final String RESOURCES_PATTERN = "/resources/**";
43
	private static final String RESOURCES_LOCATION = "/resources/";
49
	private static final String RESOURCES_LOCATION = "/resources/";
44
 
50
 
45
	private static final Logger log = LogManager.getLogger(WebMVCConfig.class);
51
	private static final Logger log = LogManager.getLogger(WebMVCConfig.class);
Line 93... Line 99...
93
				"New Spice Solutions Pvt. Ltd.", "License of API", "API license URL");
99
				"New Spice Solutions Pvt. Ltd.", "License of API", "API license URL");
94
		return apiInfo;
100
		return apiInfo;
95
	}
101
	}
96
 
102
 
97
	@Override
103
	@Override
98
	public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
104
	public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
-
 
105
 
-
 
106
		messageConverters.add(new MappingJackson2HttpMessageConverter(objectMapper()));
-
 
107
		messageConverters.add(new ByteArrayHttpMessageConverter());
-
 
108
		messageConverters.add(new ResourceHttpMessageConverter());
-
 
109
		messageConverters.add(new SourceHttpMessageConverter<Source>());
-
 
110
		messageConverters.add(new AllEncompassingFormHttpMessageConverter());
99
 
111
 
100
		converters.add(new MappingJackson2HttpMessageConverter(objectMapper()));
-
 
101
		super.addDefaultHttpMessageConverters(converters);
112
		super.configureMessageConverters(messageConverters);
102
	}
113
	}
103
 
114
 
104
	@Bean
115
	@Bean
105
	public ObjectMapper objectMapper() {
116
	public ObjectMapper objectMapper() {
106
		ObjectMapper objectMapper = new ObjectMapper();
117
		ObjectMapper objectMapper = new ObjectMapper();