Subversion Repositories SmartDukaan

Rev

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

Rev 34636 Rev 34667
Line 22... Line 22...
22
import org.apache.velocity.app.VelocityEngine;
22
import org.apache.velocity.app.VelocityEngine;
23
import org.apache.velocity.exception.VelocityException;
23
import org.apache.velocity.exception.VelocityException;
24
import org.springframework.context.annotation.Bean;
24
import org.springframework.context.annotation.Bean;
25
import org.springframework.context.annotation.ComponentScan;
25
import org.springframework.context.annotation.ComponentScan;
26
import org.springframework.context.annotation.Configuration;
26
import org.springframework.context.annotation.Configuration;
27
import org.springframework.context.annotation.Primary;
-
 
28
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
27
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
29
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
28
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
30
import org.springframework.core.io.ClassPathResource;
29
import org.springframework.core.io.ClassPathResource;
31
import org.springframework.core.io.Resource;
30
import org.springframework.core.io.Resource;
32
import org.springframework.mail.javamail.JavaMailSender;
31
import org.springframework.mail.javamail.JavaMailSender;
Line 149... Line 148...
149
    public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
148
    public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
150
        LOGGER.debug("creating messageSource bean with message path source name : " + MESSAGE_PATH_SOURCE_NAME);
149
        LOGGER.debug("creating messageSource bean with message path source name : " + MESSAGE_PATH_SOURCE_NAME);
151
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
150
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
152
        messageSource.setBasename(MESSAGE_PATH_SOURCE_NAME);
151
        messageSource.setBasename(MESSAGE_PATH_SOURCE_NAME);
153
        messageSource.setDefaultEncoding("UTF-8");
152
        messageSource.setDefaultEncoding("UTF-8");
154
        //messageSource.setDefaultEncoding("ISO 8859-1");
-
 
155
        // messageSource.setDefaultEncoding("U+0900 ");
-
 
156
        //messageSource.setDefaultEncoding("UTF-32");
-
 
157
 
153
 
158
        return messageSource;
154
        return messageSource;
159
    }
155
    }
160
 
156
 
161
    @Bean(name = "multipartResolver")
157
    @Bean(name = "multipartResolver")
Line 193... Line 189...
193
        }
189
        }
194
        LOGGER.info("Profile is [{}]", properties.get("profile"));
190
        LOGGER.info("Profile is [{}]", properties.get("profile"));
195
        return (String) properties.get("profile");
191
        return (String) properties.get("profile");
196
    }
192
    }
197
 
193
 
198
    /*@Bean(name = "mailSender")
194
    @Bean(name = "mailSender")
199
    public JavaMailSender getSendgridMailSender() {
195
    public JavaMailSender getSendgridMailSender() {
200
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
196
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
201
 
197
 
202
        // Using gmail
198
        // Using gmail
203
        mailSender.setHost("smtp.sendgrid.net");
199
        mailSender.setHost("smtp.sendgrid.net");
204
        mailSender.setPort(587);
200
        mailSender.setPort(587);
205
        mailSender.setUsername("apikey");
201
        mailSender.setUsername("apikey");
206
        mailSender.setPassword("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");
202
        mailSender.setPassword("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");
207
 
203
 
208
        Properties javaMailProperties = new Properties();
204
        Properties javaMailProperties = new Properties();
209
        javaMailProperties.put("mail.smtp.starttls.enable", "false");
205
        javaMailProperties.put("mail.smtp.starttls.enable", "false");
210
        javaMailProperties.put("mail.smtp.auth", "true");
206
        javaMailProperties.put("mail.smtp.auth", "true");
211
        javaMailProperties.put("mail.transport.protocol", "smtp");
207
        javaMailProperties.put("mail.transport.protocol", "smtp");
212
        javaMailProperties.put("mail.debug", "true");// Prints out everything on
208
        javaMailProperties.put("mail.debug", "true");// Prints out everything on
213
        // screen
209
        // screen
214
 
210
 
215
        mailSender.setJavaMailProperties(javaMailProperties);
211
        mailSender.setJavaMailProperties(javaMailProperties);
216
        return mailSender;
212
        return mailSender;
217
    }*/
-
 
218
 
-
 
219
    @Bean(name = "mailSender")
-
 
220
    @Primary
-
 
221
    public JavaMailSender getSendgridMailSender() {
-
 
222
        return googleMailSender();
-
 
223
    }
213
    }
224
 
214
 
-
 
215
 
225
    @Bean
216
    @Bean
226
    public JavaMailSender googleMailSender() {
217
    public JavaMailSender googleMailSender() {
227
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
218
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
228
        mailSender.setHost("smtp.gmail.com");
219
        mailSender.setHost("smtp.gmail.com");
229
        mailSender.setPort(465);
220
        mailSender.setPort(465);
Line 239... Line 230...
239
        props.put("mail.debug", "true");
230
        props.put("mail.debug", "true");
240
 
231
 
241
        return mailSender;
232
        return mailSender;
242
    }
233
    }
243
 
234
 
244
    /*@Bean
-
 
245
    public JavaMailSender googleMailSender() {
-
 
246
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
-
 
247
        LOGGER.info("Google mail sender - here");
-
 
248
        // Using gmail
-
 
249
        mailSender.setHost("smtp.sendgrid.net");
-
 
250
        mailSender.setPort(587);
-
 
251
        mailSender.setUsername("apikey");
-
 
252
        mailSender.setPassword("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");
-
 
253
 
-
 
254
        Properties javaMailProperties = new Properties();
-
 
255
        javaMailProperties.put("mail.smtp.starttls.enable", "false");
-
 
256
        javaMailProperties.put("mail.smtp.auth", "true");
-
 
257
        javaMailProperties.put("mail.transport.protocol", "smtp");
-
 
258
        javaMailProperties.put("mail.debug", "true");// Prints out everything on
-
 
259
        // screen
-
 
260
 
-
 
261
        mailSender.setJavaMailProperties(javaMailProperties);
-
 
262
        return mailSender;
-
 
263
        *//*JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
-
 
264
        // Using gmail
-
 
265
        mailSender.setHost("smtp.gmail.com");
-
 
266
        mailSender.setPort(587);
-
 
267
        mailSender.setUsername("build@shop2020.in");
-
 
268
        mailSender.setPassword("cafe@nes");
-
 
269
 
-
 
270
        Properties javaMailProperties = new Properties();
-
 
271
        javaMailProperties.put("mail.smtp.starttls.enable", "true");
-
 
272
        javaMailProperties.put("mail.smtp.auth", "true");
-
 
273
        javaMailProperties.put("mail.transport.protocol", "smtp");
-
 
274
        javaMailProperties.put("mail.debug", "true");// Prints out everything on screen
-
 
275
        mailSender.setJavaMailProperties(javaMailProperties);
-
 
276
        return mailSender;*//*
-
 
277
    }*/
-
 
278
 
-
 
279
    @Bean(name = "gson")
235
    @Bean(name = "gson")
280
    public Gson gson() {
236
    public Gson gson() {
281
 
237
 
282
        Gson gson = new GsonBuilder().serializeNulls().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeJsonConverter()).create();
238
        Gson gson = new GsonBuilder().serializeNulls().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeJsonConverter()).create();
283
 
239