| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.config;
|
1 |
package com.spice.profitmandi.web.config;
|
| 2 |
|
2 |
|
| 3 |
import java.io.IOException;
|
- |
|
| 4 |
import java.sql.Timestamp;
|
- |
|
| 5 |
import java.time.ZoneId;
|
- |
|
| 6 |
import java.time.ZonedDateTime;
|
- |
|
| 7 |
import java.time.format.DateTimeFormatter;
|
3 |
import java.time.format.DateTimeFormatter;
|
| 8 |
import java.util.List;
|
- |
|
| 9 |
|
4 |
|
| 10 |
import org.springframework.beans.factory.annotation.Autowired;
|
5 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 11 |
import org.springframework.context.annotation.Bean;
|
6 |
import org.springframework.context.annotation.Bean;
|
| 12 |
import org.springframework.context.annotation.ComponentScan;
|
7 |
import org.springframework.context.annotation.ComponentScan;
|
| 13 |
import org.springframework.context.annotation.Configuration;
|
8 |
import org.springframework.context.annotation.Configuration;
|
| 14 |
import org.springframework.http.converter.HttpMessageConverter;
|
- |
|
| 15 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
- |
|
| 16 |
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
9 |
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
| 17 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
10 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
| 18 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
11 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| 19 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
12 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
| 20 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
13 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
| 21 |
|
14 |
|
| 22 |
import com.fasterxml.jackson.core.JsonGenerator;
|
- |
|
| 23 |
import com.fasterxml.jackson.databind.JsonSerializer;
|
- |
|
| 24 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
- |
|
| 25 |
import com.fasterxml.jackson.databind.SerializationFeature;
|
- |
|
| 26 |
import com.fasterxml.jackson.databind.SerializerProvider;
|
- |
|
| 27 |
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
|
- |
|
| 28 |
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
- |
|
| 29 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
15 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 30 |
import com.spice.profitmandi.common.web.interceptor.SimpleCORSInterceptor;
|
16 |
import com.spice.profitmandi.common.web.interceptor.SimpleCORSInterceptor;
|
| 31 |
import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;
|
17 |
import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;
|
| 32 |
|
18 |
|
| 33 |
import springfox.documentation.builders.PathSelectors;
|
19 |
import springfox.documentation.builders.PathSelectors;
|
| Line 95... |
Line 81... |
| 95 |
"New Spice Solutions Pvt. Ltd.",
|
81 |
"New Spice Solutions Pvt. Ltd.",
|
| 96 |
"License of API",
|
82 |
"License of API",
|
| 97 |
"API license URL");
|
83 |
"API license URL");
|
| 98 |
return apiInfo;
|
84 |
return apiInfo;
|
| 99 |
}
|
85 |
}
|
| 100 |
|
- |
|
| 101 |
/*@Override
|
- |
|
| 102 |
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
- |
|
| 103 |
MappingJackson2HttpMessageConverter jacksonMessageConverter = new MappingJackson2HttpMessageConverter();
|
- |
|
| 104 |
ObjectMapper objectMapper = jacksonMessageConverter.getObjectMapper();
|
- |
|
| 105 |
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
- |
|
| 106 |
javaTimeModule.addSerializer(java.sql.Date.class, new DateSerializer());
|
- |
|
| 107 |
objectMapper.registerModule(javaTimeModule);
|
- |
|
| 108 |
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
|
- |
|
| 109 |
converters.add(jacksonMessageConverter);
|
- |
|
| 110 |
}
|
- |
|
| 111 |
|
- |
|
| 112 |
public class LocalDateSerializer extends JsonSerializer<Timestamp> {
|
- |
|
| 113 |
|
- |
|
| 114 |
@Override
|
- |
|
| 115 |
public void serialize(Timestamp value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
- |
|
| 116 |
|
- |
|
| 117 |
ZonedDateTime z = value.toInstant().atZone(ZoneId.systemDefault());
|
- |
|
| 118 |
String str = FORMATTER.format(z);
|
- |
|
| 119 |
gen.writeString(str);
|
- |
|
| 120 |
}
|
- |
|
| 121 |
}*/
|
- |
|
| 122 |
|
- |
|
| 123 |
|
- |
|
| 124 |
}
|
86 |
}
|
| 125 |
|
87 |
|