2018年在公司负责了一段时间老项目改造升级工作。因此记录下折腾的过程。
- Spring boot 最近挺火的,之前的工作并没有机会去实战。但是即使不使用Spring boot 也是可以做零配置的。
约定大于配置
- servlet3.*的规范已经支持不使用web.xml了。
- annotation的配置方式在Spring其实也存在很久了。
直奔主题
代码配置web.xml
1
| org.springframework.web.WebApplicationInitializer
|
- 实现这个接口,Override onStartup方法,就拿到钥匙了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| package cn.z201.learn.config;
import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration;
import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.filter.HiddenHttpMethodFilter; import org.springframework.web.servlet.DispatcherServlet;
import cn.z201.learn.config.app.WebAppConfig;
public class WebProjectConfigInitializer implements WebApplicationInitializer { public static final String CHARACTER_ENCODING = "UTF-8"; private final static String DISPATCHER_SERVLET_NAME = "dispatcher"; private final static String DISPATCHER_SERVLET_MAPPING = "/";
private final static String ENCODEING_FILTER_NAME = "encodefilter"; private final static String ENCODEING_FILTER_MAPPING = "/*";
@Override public void onStartup(ServletContext servletContext) throws ServletException { initializeSpringMVCConfig(servletContext); }
private void initializeSpringMVCConfig(ServletContext container) throws ServletException { CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter(); encodingFilter.setForceEncoding(true); encodingFilter.setEncoding(CHARACTER_ENCODING); FilterRegistration.Dynamic filter = container.addFilter(ENCODEING_FILTER_NAME, encodingFilter); filter = container.addFilter("hiddenHttpMethodFilter", new HiddenHttpMethodFilter()); filter.addMappingForUrlPatterns(null, true, ENCODEING_FILTER_MAPPING); AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(WebAppConfig.class); ServletRegistration.Dynamic dispatcher = container.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(dispatcherContext)); dispatcher.setLoadOnStartup(1); dispatcher.setAsyncSupported(true); dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING); }
}
|
解决Maven War提示找不到web.xml编译错误。
- 注意如果你是Mavan项目,默认情况下war项目是需要找到web.xml的。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml>
</configuration> </plugin>
|
主角WebAppConfig SpringMVC配置启动类。
1
| org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
- 继承这个类,里面有很多方法给你重写。这其实跟xml配置非常相似了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
| package cn.z201.learn.config.app;
import java.util.ArrayList; import java.util.List; import java.util.Locale;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import cn.z201.learn.config.app.support.BeetlConfiguration; import cn.z201.learn.config.app.support.DataSourceConfiguration; import cn.z201.learn.config.app.support.EhCacheConfiguration; import cn.z201.learn.config.app.support.MultipartResolverConfiguration; import cn.z201.learn.config.app.support.SchedulingConfiguration; import cn.z201.learn.config.app.support.SwaggerConfiguration; import cn.z201.learn.config.app.support.ValidatorConfiguration; import cn.z201.learn.core.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.PropertySource; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration @EnableWebMvc @EnableAsync @EnableScheduling @EnableTransactionManagement @EnableAspectJAutoProxy(proxyTargetClass = true) @Import( { DataSourceConfiguration.class , BeetlConfiguration.class, MultipartResolverConfiguration.class, SwaggerConfiguration.class , EhCacheConfiguration.class , SchedulingConfiguration.class, ValidatorConfiguration.class}) @PropertySource(value = {"classpath:config.properties"},ignoreResourceNotFound = true) @ComponentScan(basePackages = { "cn.z201" }) public class WebAppConfig extends WebMvcConfigurerAdapter { private static final Logger LOGGER = LogManager.getLogger(WebAppConfig.class); public WebAppConfig() { LOGGER.info("[Initialize WebAppConfig]"); Locale.setDefault(Locale.US); }
@Override public void addResourceHandlers(ResourceHandlerRegistry registry) { super.addResourceHandlers(registry); LOGGER.info("[Initialize addResourceHandlers]"); registry.addResourceHandler("/static/**") .addResourceLocations("/static/") .setCachePeriod(5000); }
@Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); }
@Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login"); super.addInterceptors(registry); }
@Bean public LocaleChangeInterceptor localeChangeInterceptor() { LOGGER.info("[Initialize LocaleChangeInterceptor]"); return new LocaleChangeInterceptor(); }
@Bean public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() { LOGGER.info("[Initialize MappingJackson2HttpMessageConverter]"); MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); List<MediaType> mediaType = new ArrayList<MediaType>(); mediaType.add(MediaType.APPLICATION_JSON_UTF8); mappingJackson2HttpMessageConverter.setSupportedMediaTypes(mediaType); return mappingJackson2HttpMessageConverter; } }
|
- 恩,我这里的其他配置是使用其他的Bean单独配置的。一个一个来吧。
其他配置
1. DataSourceConfiguration 数据源 没有使用ORM框架直接用jdbcTemplate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| package cn.z201.learn.config.app.support;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import com.alibaba.druid.pool.DruidDataSource;
@Configuration public class DataSourceConfiguration { private static final Logger LOGGER = LogManager.getLogger(DataSourceConfiguration.class); @Value("${db.url}") private String url; @Value("${db.username}") private String username; @Value("${db.password}") private String password; @Value("${db.maxActive}") private int maxActive; @Value("${db.initialSize}") private Integer initialSize;
@Value("${db.minIdle}") private Integer minIdle;
@Value("${db.maxWait}") private Integer maxWait;
@Value("${db.timeBetweenEvictionRunsMillis}") private Integer timeBetweenEvictionRunsMillis;
@Value("${db.minEvictableIdleTimeMillis}") private Integer minEvictableIdleTimeMillis;
@Value("${db.validationQuery}") private String validationQuery;
@Value("${db.testWhileIdle}") private Boolean testWhileIdle;
@Value("${db.testOnBorrow}") private Boolean testOnBorrow;
@Value("${db.testOnReturn}") private Boolean testOnReturn;
@Value("${db.poolPreparedStatements}") private Boolean poolPreparedStatements;
@Value("${db.maxPoolPreparedStatementPerConnectionSize}") private Integer maxPoolPreparedStatementPerConnectionSize;
@Value("${db.filters}") private String filters;
@Bean public DataSourceTransactionManager dataSourceTransactionManager() { DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager(); dataSourceTransactionManager.setDataSource(dataSource()); return dataSourceTransactionManager; }
@Bean public JdbcTemplate jdbcTemplate() { return new JdbcTemplate(dataSource()); } @Bean public DataSource dataSource(){ LOGGER.info("[Initialize DataSourceConfiguration]"); DruidDataSource dataSource = new DruidDataSource(); dataSource.setUsername(this.username); dataSource.setPassword(this.password); dataSource.setUrl(this.url);
dataSource.setInitialSize(initialSize); dataSource.setMinIdle(minIdle); dataSource.setMaxActive(maxActive); dataSource.setMaxWait(maxWait);
dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); dataSource.setValidationQuery(validationQuery); dataSource.setTestWhileIdle(testWhileIdle); dataSource.setTestOnBorrow(testOnBorrow); dataSource.setTestOnReturn(testOnReturn);
dataSource.setPoolPreparedStatements(poolPreparedStatements); dataSource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize); try { dataSource.setFilters(filters); } catch (SQLException e) { LOGGER.error("[Error DataSourceConfiguration ] {}",e.getSQLState()); } return dataSource; }
}
|
2. BeetlConfiguration 页面模板引擎
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| package cn.z201.learn.config.app.support;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.beetl.ext.spring.BeetlGroupUtilConfiguration; import org.beetl.ext.spring.BeetlSpringViewResolver; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource;
@Configuration public class BeetlConfiguration{ private static final Logger LOGGER = LogManager.getLogger(BeetlConfiguration.class);
@Bean(initMethod = "init", name = "beetlConfig") public BeetlGroupUtilConfiguration beetlConfig() { LOGGER.info("[Initialize BeetlGroupUtilConfiguration]"); BeetlGroupUtilConfiguration beetlGroupUtilConfiguration = new BeetlGroupUtilConfiguration(); beetlGroupUtilConfiguration.setConfigFileResource(new ClassPathResource("beetl.properties")); beetlGroupUtilConfiguration.setRoot("/"); return beetlGroupUtilConfiguration; } @Bean(name = "beetlSpringViewResolver") public BeetlSpringViewResolver beetlViewResolver(BeetlGroupUtilConfiguration beetlConfig) { BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver(); beetlSpringViewResolver.setContentType("text/html;charset=UTF-8"); beetlSpringViewResolver.setOrder(0); beetlSpringViewResolver.setSuffix(".html"); beetlSpringViewResolver.setConfig(beetlConfig); return beetlSpringViewResolver; }
}
|
3. MultipartResolverConfiguration 上传插件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| package cn.z201.learn.config.app.support;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@Configuration public class MultipartResolverConfiguration { private static final Logger LOGGER = LogManager.getLogger(MultipartResolverConfiguration.class); @Bean(name="multipartResolver") public CommonsMultipartResolver commonsMultipartResolver(){ LOGGER.info("[Initialize CommonsMultipartResolver]"); CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver(); commonsMultipartResolver.setDefaultEncoding("utf-8"); commonsMultipartResolver.setMaxUploadSize(104666600); commonsMultipartResolver.setMaxInMemorySize(1046666000); return commonsMultipartResolver; }
}
|
5 .SwaggerConfiguration API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| package cn.z201.learn.config.app.support;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;
import com.google.common.collect.Sets;
import io.swagger.annotations.ApiOperation; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @EnableSwagger2 public class SwaggerConfiguration {
private static final Logger LOGGER = LogManager.getLogger(SwaggerConfiguration.class); @Bean public Docket createApi() { LOGGER.info("[Initialize SwaggerConfiguration]"); return new Docket(DocumentationType.SWAGGER_2) .produces(Sets.newHashSet("application/json", "application/xml")) .consumes(Sets.newHashSet("application/json", "application/xml")) .protocols(Sets.newHashSet("http", "https")) .forCodeGeneration(true) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { ApiInfo apiInfo= new ApiInfoBuilder() .title("API管理") .description("https://my.oschina.net/z201/blog") .termsOfServiceUrl("https://my.oschina.net/z201/blog") .contact(new Contact("自己动手丰衣足食","","https://my.oschina.net/z201/blog")) .version("1.0") .build(); return apiInfo; } }
|
6. EhCacheConfiguration 缓存配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| package cn.z201.learn.config.app.support;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.ehcache.EhCacheCacheManager; import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource;
import net.sf.ehcache.CacheManager;
@Configuration @EnableCaching public class EhCacheConfiguration {
@Bean public EhCacheCacheManager cacheManager(CacheManager cacheManager) { return new EhCacheCacheManager(cacheManager); }
@Bean public EhCacheManagerFactoryBean ehcache() { EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml")); return ehCacheManagerFactoryBean; }
}
|
7 . SchedulingConfiguration 启动定时任务 Spring task
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| package cn.z201.learn.config.app.support;
import java.util.concurrent.Executor; import java.util.concurrent.Executors;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.ScheduledTaskRegistrar;
@Configuration public class SchedulingConfiguration implements SchedulingConfigurer{ @Override public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { taskRegistrar.setScheduler(taskExecutor()); } @Bean(destroyMethod="shutdown") public Executor taskExecutor() { return Executors.newScheduledThreadPool(10); }
}
|
8 . ValidatorConfiguration 验证框架配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| package cn.z201.learn.config.app.support;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.hibernate.validator.HibernateValidator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
@Configuration public class ValidatorConfiguration { private static final Logger LOGGER = LogManager.getLogger(ValidatorConfiguration.class);
@Bean("validator") public LocalValidatorFactoryBean localValidatorFactoryBean(){ LOGGER.info("[Initialize ValidatorConfiguration]"); LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean(); localValidatorFactoryBean.setProviderClass(HibernateValidator.class); localValidatorFactoryBean.setValidationMessageSource(reloadableResourceBundleMessageSource()); return new LocalValidatorFactoryBean(); } @Bean("messageSource") public ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource(){ ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource = new ReloadableResourceBundleMessageSource(); reloadableResourceBundleMessageSource.setBasename("classpath:messages"); reloadableResourceBundleMessageSource.setDefaultEncoding("UTF-8"); reloadableResourceBundleMessageSource.setCacheSeconds(120); return reloadableResourceBundleMessageSource; }
}
|
POM文件配置信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
| <properties> <java.version>1.8</java.version> <javax.el-api.version>3.0.0</javax.el-api.version> <javax.servlet-api.version>3.1.0</javax.servlet-api.version> <spring.version>4.3.8.RELEASE</spring.version> <com.ibeetl.version>2.7.15</com.ibeetl.version> <org.ehcache.version>2.10.2.2.21</org.ehcache.version> <org.log4j2.version>2.8.1</org.log4j2.version> <org.hibernate-validator.version>5.2.4.Final</org.hibernate-validator.version> <com.fasterxml.jackson.version>2.8.1</com.fasterxml.jackson.version> <net.sf.json-lib.version>2.4</net.sf.json-lib.version> <mysql.driver.version>5.1.28</mysql.driver.version> <springfox.swagger.version>2.7.0</springfox.swagger.version> <alibaba.druid.version>1.0.31</alibaba.druid.version> <org.aspectj.version>1.8.8</org.aspectj.version> <cglib.nodep.version>3.1</cglib.nodep.version> <apache.commons.fileupload>1.3.1</apache.commons.fileupload> <apache.commons.lang3>3.4</apache.commons.lang3> <apache.commons.io>2.4</apache.commons.io> <apache.commons.collections>3.2.1</apache.commons.collections> <projectlombok.version>1.16.16</projectlombok.version> <junit.version>4.12</junit.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>cn.z201.web.common</groupId> <artifactId>web.common </artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency>
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>${org.hibernate-validator.version}</version> </dependency> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>${org.quartz.version}</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </exclusion> <exclusion> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${org.aspectj.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>${org.aspectj.version}</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>${cglib.nodep.version}</version> </dependency> <dependency> <groupId>com.ibeetl</groupId> <artifactId>beetl</artifactId> <version>${com.ibeetl.version}</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>${org.ehcache.version}</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${alibaba.druid.version}</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.driver.version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${springfox.swagger.version}</version> </dependency>
<dependency> <groupId>com.drore.cloud</groupId> <artifactId>swagger-bootstrap-ui</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>${org.log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>${org.log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-jcl</artifactId> <version>${org.log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-1.2-api</artifactId> <version>${org.log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <version>${org.log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-web</artifactId> <version>${org.log4j2.version}</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>${cglib.nodep.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>${com.fasterxml.jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${com.fasterxml.jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.jaxrs</groupId> <artifactId>jackson-jaxrs-json-provider</artifactId> <version>${com.fasterxml.jackson.version}</version> </dependency> <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>${net.sf.json-lib.version}</version> <classifier>jdk15</classifier> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>${apache.commons.fileupload}</version> </dependency>
<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>${apache.commons.lang3}</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>${apache.commons.io}</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>${apache.commons.collections}</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${projectlombok.version}</version> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> <version>${javax.el-api.version}</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>${javax.servlet-api.version}</version> </dependency> </dependencies>
|
结束语
自己动手丰衣足食