Subversion Repositories SmartDukaan

Rev

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

Rev 31477 Rev 31511
Line 12... Line 12...
12
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
12
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
13
import org.apache.logging.log4j.LogManager;
13
import org.apache.logging.log4j.LogManager;
14
import org.apache.logging.log4j.Logger;
14
import org.apache.logging.log4j.Logger;
15
import org.apache.velocity.app.VelocityEngine;
15
import org.apache.velocity.app.VelocityEngine;
16
import org.apache.velocity.exception.VelocityException;
16
import org.apache.velocity.exception.VelocityException;
17
import org.apache.velocity.tools.generic.EscapeTool;
-
 
18
import org.springframework.context.annotation.Bean;
17
import org.springframework.context.annotation.Bean;
19
import org.springframework.context.annotation.ComponentScan;
18
import org.springframework.context.annotation.ComponentScan;
20
import org.springframework.context.annotation.Configuration;
19
import org.springframework.context.annotation.Configuration;
21
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
20
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
22
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
21
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
Line 26... Line 25...
26
import org.springframework.mail.javamail.JavaMailSenderImpl;
25
import org.springframework.mail.javamail.JavaMailSenderImpl;
27
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
26
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
28
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
27
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
29
import org.springframework.web.servlet.ViewResolver;
28
import org.springframework.web.servlet.ViewResolver;
30
import org.springframework.web.servlet.view.BeanNameViewResolver;
29
import org.springframework.web.servlet.view.BeanNameViewResolver;
-
 
30
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
31
import org.springframework.web.servlet.view.velocity.VelocityConfigurer;
31
import org.springframework.web.servlet.view.velocity.VelocityConfigurer;
32
import org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver;
-
 
33
 
32
 
34
import java.io.IOException;
33
import java.io.IOException;
35
import java.math.RoundingMode;
34
import java.math.RoundingMode;
36
import java.text.DecimalFormat;
35
import java.text.DecimalFormat;
37
import java.text.NumberFormat;
36
import java.text.NumberFormat;
Line 44... Line 43...
44
import java.util.Properties;
43
import java.util.Properties;
45
 
44
 
46
@SuppressWarnings("deprecation")
45
@SuppressWarnings("deprecation")
47
@Configuration
46
@Configuration
48
@ComponentScan("com.spice.profitmandi.*")
47
@ComponentScan("com.spice.profitmandi.*")
-
 
48
//@Import(RepositoryRestMvcConfiguration.class)
49
public class AppConfig {
49
public class AppConfig {
50
 
50
 
51
	private static final String VELOCITY_PATH_PREFIX = "/WEB-INF/views/ftl/";
51
	private static final String VELOCITY_PATH_PREFIX = "/WEB-INF/views/ftl/";
52
	private static final String VELOCITY_PATH_SUFFIX = ".vm";
52
	private static final String VELOCITY_PATH_SUFFIX = ".vm";
53
	private static final String MESSAGE_PATH_SOURCE_NAME = "classpath:message";
53
	private static final String MESSAGE_PATH_SOURCE_NAME = "classpath:message";
Line 94... Line 94...
94
		attributesMap.put("dateTimeFormatter", dateTimeFormatter);
94
		attributesMap.put("dateTimeFormatter", dateTimeFormatter);
95
		attributesMap.put("version", "157");
95
		attributesMap.put("version", "157");
96
		attributesMap.put("cssVersion", "10");
96
		attributesMap.put("cssVersion", "10");
97
		attributesMap.put("isDev", getActiveProfile().equals("dev"));
97
		attributesMap.put("isDev", getActiveProfile().equals("dev"));
98
		attributesMap.put("vmUtils", new Utils());
98
		attributesMap.put("vmUtils", new Utils());
99
		attributesMap.put("esc", new EscapeTool());
99
		//attributesMap.put("esc", new EscapeTool());
100
		attributesMap.put("ru", RoundingMode.HALF_UP);
100
		attributesMap.put("ru", RoundingMode.HALF_UP);
101
		return attributesMap;
101
		return attributesMap;
102
	}
102
	}
103
 
103
 
-
 
104
//	@Bean
-
 
105
//	public ViewResolver viewResolver() {
-
 
106
//		VelocityLayoutViewResolver bean = new VelocityLayoutViewResolver();
-
 
107
//		bean.setPrefix("");
-
 
108
//		bean.setSuffix(VELOCITY_PATH_SUFFIX);
-
 
109
//		bean.setRequestContextAttribute("rc");
-
 
110
//		bean.setAttributesMap(this.velocityAttributesMap());
-
 
111
//		return bean;
-
 
112
//	}
-
 
113
 
104
	@Bean
114
	@Bean
105
	public ViewResolver viewResolver() {
115
	public ViewResolver viewResolver() {
106
		VelocityLayoutViewResolver bean = new VelocityLayoutViewResolver();
116
		FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
107
		bean.setPrefix("");
117
		resolver.setCache(true);
108
		bean.setSuffix(VELOCITY_PATH_SUFFIX);
118
		resolver.setPrefix("");
109
		bean.setRequestContextAttribute("rc");
119
		resolver.setSuffix(".ftl");
110
		bean.setAttributesMap(this.velocityAttributesMap());
-
 
111
		return bean;
120
		return resolver;
112
	}
121
	}
113
 
122
 
114
	@Bean
123
	@Bean
115
	public ViewResolver beanNameViewResolver() {
124
	public ViewResolver beanNameViewResolver() {
116
		BeanNameViewResolver resolver = new BeanNameViewResolver();
125
		BeanNameViewResolver resolver = new BeanNameViewResolver();
Line 191... Line 200...
191
 
200
 
192
		mailSender.setJavaMailProperties(javaMailProperties);
201
		mailSender.setJavaMailProperties(javaMailProperties);
193
		return mailSender;
202
		return mailSender;
194
	}
203
	}
195
 
204
 
-
 
205
	@Bean(name = "mailSender")
-
 
206
	public JavaMailSender googleMailSender() {
-
 
207
		JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
-
 
208
		// Using gmail
-
 
209
		mailSender.setHost("smtp.gmail.com");
-
 
210
		mailSender.setPort(587);
-
 
211
		mailSender.setUsername("build@shop2020.in");
-
 
212
		mailSender.setPassword("cafe@nes");
-
 
213
 
-
 
214
		Properties javaMailProperties = new Properties();
-
 
215
		javaMailProperties.put("mail.smtp.starttls.enable", "true");
-
 
216
		javaMailProperties.put("mail.smtp.auth", "true");
-
 
217
		javaMailProperties.put("mail.transport.protocol", "smtp");
-
 
218
		javaMailProperties.put("mail.debug", "true");// Prints out everything on screen
-
 
219
		mailSender.setJavaMailProperties(javaMailProperties);
-
 
220
		return mailSender;
-
 
221
	}
-
 
222
 
196
	@Bean(name = "gson")
223
	@Bean(name = "gson")
197
	public Gson gson() {
224
	public Gson gson() {
198
 
225
 
199
		Gson gson = new GsonBuilder().serializeNulls()
226
		Gson gson = new GsonBuilder().serializeNulls()
200
				.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeJsonConverter()).create();
227
				.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeJsonConverter()).create();