| Line 5... |
Line 5... |
| 5 |
import java.time.LocalDateTime;
|
5 |
import java.time.LocalDateTime;
|
| 6 |
import java.util.Properties;
|
6 |
import java.util.Properties;
|
| 7 |
|
7 |
|
| 8 |
import org.apache.logging.log4j.LogManager;
|
8 |
import org.apache.logging.log4j.LogManager;
|
| 9 |
import org.apache.logging.log4j.Logger;
|
9 |
import org.apache.logging.log4j.Logger;
|
| - |
|
10 |
import org.apache.velocity.app.VelocityEngine;
|
| - |
|
11 |
import org.apache.velocity.exception.VelocityException;
|
| 10 |
import org.springframework.context.annotation.Bean;
|
12 |
import org.springframework.context.annotation.Bean;
|
| 11 |
import org.springframework.context.annotation.ComponentScan;
|
13 |
import org.springframework.context.annotation.ComponentScan;
|
| 12 |
import org.springframework.context.annotation.Configuration;
|
14 |
import org.springframework.context.annotation.Configuration;
|
| 13 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
15 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 14 |
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
16 |
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
| 15 |
import org.springframework.core.io.ClassPathResource;
|
17 |
import org.springframework.core.io.ClassPathResource;
|
| 16 |
import org.springframework.core.io.Resource;
|
18 |
import org.springframework.core.io.Resource;
|
| 17 |
import org.springframework.mail.javamail.JavaMailSender;
|
19 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 18 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
20 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
| - |
|
21 |
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
| 19 |
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
22 |
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
| 20 |
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
23 |
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
| 21 |
|
24 |
|
| 22 |
import com.google.gson.Gson;
|
25 |
import com.google.gson.Gson;
|
| 23 |
import com.google.gson.GsonBuilder;
|
26 |
import com.google.gson.GsonBuilder;
|
| Line 39... |
Line 42... |
| 39 |
|
42 |
|
| 40 |
public void setResource(Resource resource) {
|
43 |
public void setResource(Resource resource) {
|
| 41 |
AppConfig.resource = resource;
|
44 |
AppConfig.resource = resource;
|
| 42 |
}
|
45 |
}
|
| 43 |
|
46 |
|
| 44 |
@Bean(name = "viewResolver")
|
47 |
/*
|
| 45 |
public InternalResourceViewResolver getViewResolver() {
|
48 |
* @Bean(name = "viewResolver") public InternalResourceViewResolver
|
| 46 |
LOGGER.debug("creating view resolver bean with prefix : " + PATH_PREFIX + " and suffix : " + PATH_SUFFIX);
|
49 |
* getViewResolver() { LOGGER.debug("creating view resolver bean with prefix : "
|
| 47 |
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
|
50 |
* + PATH_PREFIX + " and suffix : " + PATH_SUFFIX); InternalResourceViewResolver
|
| 48 |
viewResolver.setPrefix(PATH_PREFIX);
|
51 |
* viewResolver = new InternalResourceViewResolver();
|
| 49 |
viewResolver.setSuffix(PATH_SUFFIX);
|
52 |
* viewResolver.setPrefix(PATH_PREFIX); viewResolver.setSuffix(PATH_SUFFIX);
|
| 50 |
return viewResolver;
|
53 |
* return viewResolver; }
|
| 51 |
}
|
54 |
*/
|
| 52 |
|
55 |
|
| 53 |
@Bean(name = "messageSource")
|
56 |
@Bean(name = "messageSource")
|
| 54 |
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
|
57 |
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
|
| 55 |
LOGGER.debug("creating messageSource bean with message path source name : " + MESSAGE_PATH_SOURCE_NAME);
|
58 |
LOGGER.debug("creating messageSource bean with message path source name : " + MESSAGE_PATH_SOURCE_NAME);
|
| 56 |
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
|
59 |
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
|
| Line 123... |
Line 126... |
| 123 |
|
126 |
|
| 124 |
return gson;
|
127 |
return gson;
|
| 125 |
|
128 |
|
| 126 |
}
|
129 |
}
|
| 127 |
|
130 |
|
| - |
|
131 |
@Bean(name = "veloctyEngine")
|
| - |
|
132 |
public VelocityEngine velocityEngine() throws VelocityException, IOException {
|
| - |
|
133 |
VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
|
| - |
|
134 |
// Properties props = new Properties();
|
| - |
|
135 |
// props.put("resource.loader", "file");
|
| - |
|
136 |
|
| - |
|
137 |
// props.put("file.resource.loader.description", "Velocity File Resource
|
| - |
|
138 |
// Loader");
|
| - |
|
139 |
// props.put("file.resource.loader.class",
|
| - |
|
140 |
// "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
|
| - |
|
141 |
// props.put("file.resource.loader.cache", true);
|
| - |
|
142 |
// props.put("file.resource.loader.path", ".");
|
| - |
|
143 |
|
| - |
|
144 |
Properties velocityProperties = new Properties();
|
| - |
|
145 |
velocityProperties.put("resource.loader", "class");
|
| - |
|
146 |
velocityProperties.put("class.resource.loader.class",
|
| - |
|
147 |
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
| - |
|
148 |
velocityProperties.put("file.resource.loader.cache", true);
|
| - |
|
149 |
velocityProperties.put("file.resource.loader.unicode", true);
|
| - |
|
150 |
velocityProperties.put("input.encoding", "UTF-8");
|
| - |
|
151 |
velocityProperties.put("output.encoding", "UTF-8");
|
| - |
|
152 |
velocityProperties.put("overrideLogging", true);
|
| - |
|
153 |
|
| - |
|
154 |
// velocityProperties.put("file.resource.loader.path", ".");
|
| - |
|
155 |
|
| - |
|
156 |
factory.setVelocityProperties(velocityProperties);
|
| - |
|
157 |
|
| - |
|
158 |
return factory.createVelocityEngine();
|
| - |
|
159 |
|
| - |
|
160 |
}
|
| 128 |
}
|
161 |
}
|
| 129 |
|
162 |
|