常用工具类:1.密码加密工具类,2.事务控制工具类,3.填充表单数据到javabean的工具类,4.dao接口代理实现类的工厂,5.解决请求响应乱码,6.批量注入工具类;
常用坐标:maven常用坐标,spring常用坐标
  1. package com.itheima.utils;
  2. import java.security.MessageDigest;
  3. import sun.misc.BASE64Encoder;
  4. public class MD5Util {
  5. /**
  6. * 密码加密
  7. * @param password
  8. * @return
  9. * @throws Exception
  10. */
  11. public static String md5(String password){
  12. try {
  13. //1.创建加密对象
  14. MessageDigest md5 = MessageDigest.getInstance("md5");
  15. //2.加密密码
  16. byte[] by = md5.digest(password.getBytes());
  17. //3.创建编码对象
  18. BASE64Encoder encoder = new BASE64Encoder();
  19. //4.对结果编码
  20. return encoder.encode(by);
  21. }catch (Exception e){
  22. throw new RuntimeException(e);
  23. }
  24. }
  25. }

 

  1. package com.itheima.utils;
  2. import org.apache.ibatis.session.SqlSession;
  3. public class TransactionUtil {
  4. /**
  5. * 提交释放
  6. * @param sqlSession
  7. */
  8. public static void commit(SqlSession sqlSession){
  9. if(sqlSession!=null) {
  10. sqlSession.commit();
  11. }
  12. }
  13. /**
  14. * 回滚释放
  15. * @param sqlSession
  16. */
  17. public static void rollback(SqlSession sqlSession){
  18. if(sqlSession!=null) {
  19. sqlSession.rollback();
  20. }
  21. }
  22. /**
  23. * 单独释放
  24. * @param sqlSession
  25. */
  26. public static void close(SqlSession sqlSession){
  27. if(sqlSession!=null) sqlSession.close();
  28. }
  29. }

 

  1. package com.itheima.utils;
  2. import javax.servlet.http.HttpServletRequest;
  3. import org.apache.commons.beanutils.BeanUtils;
  4. import org.apache.commons.beanutils.ConvertUtils;
  5. import org.apache.commons.beanutils.converters.DateConverter;
  6. import org.apache.commons.fileupload.FileItem;
  7. import org.apache.commons.fileupload.servlet.ServletFileUpload;
  8. import java.beans.PropertyDescriptor;
  9. import java.io.File;
  10. import java.lang.reflect.Method;
  11. import java.util.Date;
  12. import java.util.List;
  13. /**
  14. * 填充表单数据到javabean的工具类
  15. *
  16. */
  17. public class BeanUtil {
  18. /**
  19. * 封装表单中的数据到javabean中
  20. * @param request 表单中的数据
  21. * @param clazz 封装到哪个javabean
  22. * @return 封装好的javabean对象
  23. * 使用的是泛型。泛型必须先声明再使用。声明必须在返回值之前
  24. * T指的就是泛型,它可以是任意字符,只是作为一个占位符。
  25. * 声明时用什么字符,使用时就得用什么
  26. */
  27. public static <T> T fillBean(HttpServletRequest request,Class<T> clazz){
  28. //1.定义一个T类型的javabean
  29. T bean = null;
  30. try{
  31. //2.实例化bean对象
  32. bean = clazz.newInstance();
  33. //3.使用BeanUtils的方法进行封装
  34. BeanUtils.populate(bean, request.getParameterMap());
  35. //4.返回
  36. return bean;
  37. }catch(Exception e){
  38. throw new RuntimeException(e);
  39. }
  40. }
  41. /**
  42. * 封装表单中的数据到javabean中,带有日期格式数据
  43. * @param request 表单中的数据
  44. * @param clazz 封装到哪个javabean
  45. * @return 封装好的javabean对象
  46. * 使用的是泛型。泛型必须先声明再使用。声明必须在返回值之前
  47. * T指的就是泛型,它可以是任意字符,只是作为一个占位符。
  48. * 声明时用什么字符,使用时就得用什么
  49. */
  50. public static <T> T fillBean(HttpServletRequest request,Class<T> clazz,String datePattern){
  51. //1.定义一个T类型的javabean
  52. T bean = null;
  53. try{
  54. //2.实例化bean对象
  55. bean = clazz.newInstance();
  56. //3.创建日期转换器对象
  57. DateConverter converter = new DateConverter();
  58. converter.setPattern(datePattern);
  59. //4.设置转换器
  60. ConvertUtils.register(converter, Date.class);
  61. //5.使用BeanUtils的方法进行封装
  62. BeanUtils.populate(bean, request.getParameterMap());
  63. //6.返回
  64. return bean;
  65. }catch(Exception e){
  66. throw new RuntimeException(e);
  67. }
  68. }
  69. /**
  70. * 文件上传的表单填充
  71. * @param items 文件上传的表单项
  72. * @param clazz 要封装的实体类字节码
  73. * @param <T> 泛型
  74. * @return 返回封装好的对象
  75. */
  76. public static <T> T fillBean(List<FileItem> items,Class<T> clazz){
  77. //1.定义一个T类型的javabean
  78. T bean = null;
  79. try{
  80. //2.实例化Bean
  81. bean = clazz.newInstance();
  82. //3.遍历文件项集合
  83. for(FileItem item : items){
  84. //4.判断是不是文件
  85. if(item.isFormField()){//表单字段,不是文件
  86. //5.取出表单中的name属性取值
  87. String fieldName = item.getFieldName();
  88. //6.使用UTF-8字符集取出表单数据
  89. String fieldValue = item.getString("UTF-8");
  90. //7.创建属性描述器对象
  91. PropertyDescriptor pd = new PropertyDescriptor(fieldName,clazz);
  92. //8.获取写方法(setXXX方法)
  93. Method method = pd.getWriteMethod();
  94. //9.把数据填充到bean中
  95. method.invoke(bean,fieldValue);
  96. }
  97. }
  98. //10.返回
  99. return bean;
  100. }catch(Exception e){
  101. throw new RuntimeException(e);
  102. }
  103. }
  104. }

 

  1. package com.itheima.factory;
  2. import org.apache.ibatis.io.Resources;
  3. import org.apache.ibatis.session.SqlSession;
  4. import org.apache.ibatis.session.SqlSessionFactory;
  5. import org.apache.ibatis.session.SqlSessionFactoryBuilder;
  6. import java.io.InputStream;
  7. /**
  8. * 用于生成dao接口代理实现类的工厂
  9. */
  10. public class MapperFactory {
  11. private static SqlSessionFactory factory;
  12. private static ThreadLocal<SqlSession> tl = new ThreadLocal<SqlSession>();
  13. static {
  14. InputStream in = null;
  15. try {
  16. //1.读取mybatis主配置文件
  17. in = Resources.getResourceAsStream("SqlMapConfig.xml");
  18. //2.创建构建者对象
  19. SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
  20. //3.使用构建者创建SqlSessionFactory工厂
  21. factory = builder.build(in);
  22. }catch (Exception e){
  23. //打印异常信息到控制台
  24. e.printStackTrace();
  25. //抛出错误提示程序终止执行
  26. throw new ExceptionInInitializerError("初始化SqlSessionFactory失败");
  27. }finally {
  28. //释放流对象
  29. if(in != null){
  30. try{
  31. in.close();
  32. }catch (Exception e){
  33. e.printStackTrace();
  34. }
  35. }
  36. }
  37. }
  38. /**
  39. * 获取SqlSession对象
  40. * @return
  41. * 保留此方法是为了后面对业务层方法增强,利用AOP添加事务
  42. */
  43. public static SqlSession getSqlSession(){
  44. return factory.openSession(false);
  45. }
  46. /**
  47. * 获取Dao接口的代理实现类
  48. * @param daoClass dao接口字节码
  49. * @return
  50. */
  51. public static <T> T getMapper(SqlSession sqlSession,Class<T> daoClass){
  52. //1.判断传入的SqlSession是否为null
  53. if(sqlSession == null){
  54. return null;
  55. }
  56. //2.不为null,创建代理实现类
  57. return sqlSession.getMapper(daoClass);
  58. }
  59. }

 

  1. package com.itheima.web.controller.filter;
  2. import javax.servlet.*;
  3. import javax.servlet.annotation.WebFilter;
  4. import javax.servlet.annotation.WebInitParam;
  5. import javax.servlet.http.HttpServletRequest;
  6. import javax.servlet.http.HttpServletResponse;
  7. import java.io.IOException;
  8. @WebFilter(value = "/*",initParams={@WebInitParam(name = "encoding",value = "UTF-8")})
  9. public class CharacterEncodingFilter implements Filter {
  10. private FilterConfig filterConfig;
  11. /**
  12. * 初始化方法,获取过滤器的配置对象
  13. * @param filterConfig
  14. * @throws ServletException
  15. */
  16. @Override
  17. public void init(FilterConfig filterConfig) throws ServletException {
  18. this.filterConfig = filterConfig;
  19. }
  20. @Override
  21. public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
  22. //1.定义和协议相关的请求和响应对象
  23. HttpServletRequest request ;
  24. HttpServletResponse response;
  25. try{
  26. //2.把参数转换成协议相关的对象
  27. request = (HttpServletRequest)req;
  28. response = (HttpServletResponse)resp;
  29. //3.获取配置的字符集
  30. String encoding = filterConfig.getInitParameter("encoding");
  31. //4.设置请求参数的字符集
  32. request.setCharacterEncoding(encoding);
  33. //5.设置响应对象输出响应正文时的字符集
  34. response.setContentType("text/html;charset=UTF-8");
  35. //6.放行
  36. chain.doFilter(request,response);
  37. }catch (Exception e){
  38. e.printStackTrace();
  39. }
  40. }
  41. @Override
  42. public void destroy() {
  43. //可以做一些清理操作
  44. }
  45. }

 

  1. package config.registrar;
  2. import org.springframework.beans.factory.support.BeanDefinitionRegistry;
  3. import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
  4. import org.springframework.context.annotation.ComponentScan;
  5. import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
  6. import org.springframework.core.io.support.PropertiesLoaderUtils;
  7. import org.springframework.core.type.AnnotationMetadata;
  8. import org.springframework.core.type.filter.AspectJTypeFilter;
  9. import org.springframework.core.type.filter.TypeFilter;
  10. import java.io.IOException;
  11. import java.util.Map;
  12. import java.util.Properties;
  13. public class CustomeImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
  14. private String expression;
  15. public CustomeImportBeanDefinitionRegistrar(){
  16. try {
  17. //初始化时指定加载的properties文件名
  18. Properties loadAllProperties = PropertiesLoaderUtils.loadAllProperties("import.properties");
  19. //设定加载的属性名
  20. expression = loadAllProperties.getProperty("path");
  21. } catch (IOException e) {
  22. e.printStackTrace();
  23. }
  24. }
  25. @Override
  26. public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
  27. //1.定义扫描包的名称
  28. String[] basePackages = null;
  29. //2.判断有@Import注解的类上是否有@ComponentScan注解
  30. if (importingClassMetadata.hasAnnotation(ComponentScan.class.getName())) {
  31. //3.取出@ComponentScan注解的属性
  32. Map<String, Object> annotationAttributes = importingClassMetadata.getAnnotationAttributes(ComponentScan.class.getName());
  33. //4.取出属性名称为basePackages属性的值
  34. basePackages = (String[]) annotationAttributes.get("basePackages");
  35. }
  36. //5.判断是否有此属性(如果没有ComponentScan注解则属性值为null,如果有ComponentScan注解,则basePackages默认为空数组)
  37. if (basePackages == null || basePackages.length == 0) {
  38. String basePackage = null;
  39. try {
  40. //6.取出包含@Import注解类的包名
  41. basePackage = Class.forName(importingClassMetadata.getClassName()).getPackage().getName();
  42. } catch (ClassNotFoundException e) {
  43. e.printStackTrace();
  44. }
  45. //7.存入数组中
  46. basePackages = new String[] {basePackage};
  47. }
  48. //8.创建类路径扫描器
  49. ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(registry, false);
  50. //9.创建类型过滤器(此处使用切入点表达式类型过滤器)
  51. TypeFilter typeFilter = new AspectJTypeFilter(expression,this.getClass().getClassLoader());
  52. //10.给扫描器加入类型过滤器
  53. scanner.addIncludeFilter(typeFilter);
  54. //11.扫描指定包
  55. scanner.scan(basePackages);
  56. }
  57. }

 

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>2.1.8.RELEASE</version>
  5. <relativePath/> <!-- lookup parent from repository -->
  6. </parent>
  7.  
  8. <dependencies>
  9. <!--spring环境-->
  10. <!--spring环境-->
  11. <!--spring环境-->
  12. <dependency>
  13. <groupId>org.springframework</groupId>
  14. <artifactId>spring-context</artifactId>
  15. <version>5.1.9.RELEASE</version>
  16. </dependency>
  17.  
  18. <!--mybatis环境-->
  19. <!--mybatis环境-->
  20. <!--mybatis环境-->
  21. <dependency>
  22. <groupId>org.mybatis</groupId>
  23. <artifactId>mybatis</artifactId>
  24. <version>3.5.3</version>
  25. </dependency>
  26.  
  27. <!--mysql环境-->
  28. <dependency>
  29. <groupId>mysql</groupId>
  30. <artifactId>mysql-connector-java</artifactId>
  31. <version>5.1.47</version>
  32. </dependency>
  33.  
  34. <!--spring整合jdbc-->
  35. <dependency>
  36. <groupId>org.springframework</groupId>
  37. <artifactId>spring-jdbc</artifactId>
  38. <version>5.1.9.RELEASE</version>
  39. </dependency>
  40.  
  41. <!--spring整合mybatis-->
  42. <dependency>
  43. <groupId>org.mybatis</groupId>
  44. <artifactId>mybatis-spring</artifactId>
  45. <version>2.0.3</version>
  46. </dependency>
  47.  
  48. <!--druid连接池-->
  49. <dependency>
  50. <groupId>com.alibaba</groupId>
  51. <artifactId>druid</artifactId>
  52. <version>1.1.16</version>
  53. </dependency>
  54.  
  55. <!--AOP-->
  56. <dependency>
  57. <groupId>org.aspectj</groupId>
  58. <artifactId>aspectjweaver</artifactId>
  59. <version>1.9.4</version>
  60. </dependency>
  61.  
  62. <!--分页插件坐标-->
  63. <dependency>
  64. <groupId>com.github.pagehelper</groupId>
  65. <artifactId>pagehelper</artifactId>
  66. <version>5.1.2</version>
  67. </dependency>
  68.  
  69. <!--springmvc环境-->
  70. <!--springmvc环境-->
  71. <!--springmvc环境-->
  72. <dependency>
  73. <groupId>org.springframework</groupId>
  74. <artifactId>spring-webmvc</artifactId>
  75. <version>5.1.9.RELEASE</version>
  76. </dependency>
  77.  
  78. <!--jackson相关坐标3个-->
  79. <dependency>
  80. <groupId>com.fasterxml.jackson.core</groupId>
  81. <artifactId>jackson-databind</artifactId>
  82. <version>2.9.0</version>
  83. </dependency>
  84. <dependency>
  85. <groupId>com.fasterxml.jackson.core</groupId>
  86. <artifactId>jackson-core</artifactId>
  87. <version>2.9.0</version>
  88. </dependency>
  89. <dependency>
  90. <groupId>com.fasterxml.jackson.core</groupId>
  91. <artifactId>jackson-annotations</artifactId>
  92. <version>2.9.0</version>
  93. </dependency>
  94.  
  95. <!--servlet环境-->
  96. <dependency>
  97. <groupId>javax.servlet</groupId>
  98. <artifactId>javax.servlet-api</artifactId>
  99. <version>3.1.0</version>
  100. <scope>provided</scope>
  101. </dependency>
  102.  
  103. <!--jsp坐标-->
  104. <dependency>
  105. <groupId>javax.servlet.jsp</groupId>
  106. <artifactId>jsp-api</artifactId>
  107. <version>2.1</version>
  108. <scope>provided</scope>
  109. </dependency>
  110.  
  111. <!--导入校验的jsr303规范-->
  112. <dependency>
  113. <groupId>javax.validation</groupId>
  114. <artifactId>validation-api</artifactId>
  115. <version>2.0.1.Final</version>
  116. </dependency>
  117. <!--导入校验框架实现技术-->
  118. <dependency>
  119. <groupId>org.hibernate</groupId>
  120. <artifactId>hibernate-validator</artifactId>
  121. <version>6.1.0.Final</version>
  122. </dependency>
  123.  
  124. <dependency>
  125. <groupId>org.jboss.logging</groupId>
  126. <artifactId>jboss-logging</artifactId>
  127. <version>3.3.2.Final</version>
  128. </dependency>
  129.  
  130. <dependency>
  131. <groupId>com.fasterxml</groupId>
  132. <artifactId>classmate</artifactId>
  133. <version>1.3.4</version>
  134. </dependency>
  135.  
  136. <!--其他组件-->
  137. <!--其他组件-->
  138. <!--其他组件-->
  139. <!--junit单元测试-->
  140. <dependency>
  141. <groupId>junit</groupId>
  142. <artifactId>junit</artifactId>
  143. <version>4.12</version>
  144. </dependency>
  145. <!--spring整合junit-->
  146. <dependency>
  147. <groupId>org.springframework</groupId>
  148. <artifactId>spring-test</artifactId>
  149. <version>5.1.9.RELEASE</version>
  150. </dependency>
  151.  
  152. <!--日志-->
  153. <dependency>
  154. <groupId>org.slf4j</groupId>
  155. <artifactId>slf4j-api</artifactId>
  156. <version>1.7.21</version>
  157. </dependency>
  158. <dependency>
  159. <groupId>org.slf4j</groupId>
  160. <artifactId>slf4j-log4j12</artifactId>
  161. <version>1.7.21</version>
  162. </dependency>
  163.  
  164. <!--Dubbo的起步依赖,版本2.7之后统一为org.apache.dubbo -->
  165. <dependency>
  166. <groupId>org.apache.dubbo</groupId>
  167. <artifactId>dubbo</artifactId>
  168. <version>2.7.4.1</version>
  169. </dependency>
  170. <dependency>
  171. <groupId>io.netty</groupId>
  172. <artifactId>netty-all</artifactId>
  173. <version>4.1.39.Final</version>
  174. </dependency>
  175. <dependency>
  176. <groupId>org.yaml</groupId>
  177. <artifactId>snakeyaml</artifactId>
  178. <version>1.23</version>
  179. </dependency>
  180. <!--ZooKeeper客户端实现 -->
  181. <dependency>
  182. <groupId>org.apache.curator</groupId>
  183. <artifactId>curator-framework</artifactId>
  184. <version>4.0.0</version>
  185. </dependency>
  186. <!--ZooKeeper客户端实现 -->
  187. <dependency>
  188. <groupId>org.apache.curator</groupId>
  189. <artifactId>curator-recipes</artifactId>
  190. <version>4.0.0</version>
  191. </dependency>
  192.  
  193. <!--web开发的起步依赖-->
  194. <dependency>
  195. <groupId>org.springframework.boot</groupId>
  196. <artifactId>spring-boot-starter-web</artifactId>
  197. </dependency>
  198.  
  199. <dependency>
  200. <groupId>org.mybatis.spring.boot</groupId>
  201. <artifactId>mybatis-spring-boot-starter</artifactId>
  202. <version>2.1.0</version>
  203. </dependency>
  204.  
  205. <dependency>
  206. <groupId>org.springframework.boot</groupId>
  207. <artifactId>spring-boot-starter-jetty</artifactId>
  208. <version>2.1.8.RELEASE</version>
  209. </dependency>
  210.  
  211. <dependency>
  212. <groupId>mysql</groupId>
  213. <artifactId>mysql-connector-java</artifactId>
  214. <version>5.1.47</version>
  215. </dependency>
  216. <dependency>
  217. <groupId>org.springframework.boot</groupId>
  218. <artifactId>spring-boot-starter-test</artifactId>
  219. <version>2.1.8.RELEASE</version>
  220. </dependency>
  221.  
  222. <dependency>
  223. <groupId>org.springframework.boot</groupId>
  224. <artifactId>spring-boot-starter-data-redis</artifactId>
  225. <version>2.1.8.RELEASE</version>
  226. </dependency>
  227.  
  228. <dependency>
  229. <groupId>org.springframework.boot</groupId>
  230. <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
  231. <version>2.1.8.RELEASE</version>
  232. </dependency>
  233.  
  234. <dependency>
  235. <groupId>org.springframework.boot</groupId>
  236. <artifactId>spring-boot-starter-actuator</artifactId>
  237. <version>2.1.8.RELEASE</version>
  238. </dependency>
  239.  
  240. <dependency>
  241. <groupId>de.codecentric</groupId>
  242. <artifactId>spring-boot-admin-starter-server</artifactId>
  243. <version>2.1.5</version>
  244. </dependency>
  245.  
  246. <dependency>
  247. <groupId>de.codecentric</groupId>
  248. <artifactId>spring-boot-admin-starter-client</artifactId>
  249. <version>2.1.5</version>
  250. </dependency>
  251.  
  252. <dependency>
  253. <groupId>redis.clients</groupId>
  254. <artifactId>jedis</artifactId>
  255. <version>2.9.3</version>
  256. </dependency>
  257.  
  258. <!--引入es的坐标-->
  259. <dependency>
  260. <groupId>org.elasticsearch.client</groupId>
  261. <artifactId>elasticsearch-rest-high-level-client</artifactId>
  262. <version>7.4.0</version>
  263. </dependency>
  264. <dependency>
  265. <groupId>org.elasticsearch.client</groupId>
  266. <artifactId>elasticsearch-rest-client</artifactId>
  267. <version>7.4.0</version>
  268. </dependency>
  269. <dependency>
  270. <groupId>org.elasticsearch</groupId>
  271. <artifactId>elasticsearch</artifactId>
  272. <version>7.4.0</version>
  273. </dependency>
  274.  
  275. <dependency>
  276. <groupId>com.alibaba</groupId>
  277. <artifactId>fastjson</artifactId>
  278. <version>1.2.4</version>
  279. </dependency>
  280.  
  281. <dependency>
  282. <groupId>org.apache.rocketmq</groupId>
  283. <artifactId>rocketmq-client</artifactId>
  284. <version>4.5.2</version>
  285. </dependency>
  286.  
  287. <dependency>
  288. <groupId>org.projectlombok</groupId>
  289. <artifactId>lombok</artifactId>
  290. <version>1.18.8</version>
  291. </dependency>
  292.  
  293. <dependency>
  294. <groupId>com.baomidou</groupId>
  295. <artifactId>mybatis-plus-boot-starter</artifactId>
  296. <version>3.4.0</version>
  297. </dependency>
  298.  
  299. </dependencies>
  300.  
  301. <build>
  302. <plugins>
  303. <plugin>
  304. <groupId>org.springframework.boot</groupId>
  305. <artifactId>spring-boot-maven-plugin</artifactId>
  306. <version>2.1.8.RELEASE</version>
  307. </plugin>
  308.  
  309. <plugin>
  310. <groupId>org.apache.tomcat.maven</groupId>
  311. <artifactId>tomcat7-maven-plugin</artifactId>
  312. <version>2.1</version>
  313. <configuration>
  314. <port>80</port>
  315. <path>/</path>
  316. <uriEncoding>UTF-8</uriEncoding>
  317. </configuration>
  318. </plugin>
  319. </plugins>
  320. </build>

 

  1. <properties>
  2. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  3. <maven.compiler.source>1.8</maven.compiler.source>
  4. <maven.compiler.target>1.8</maven.compiler.target>
  5. </properties>
  6.  
  7. <dependencies>
  8. <!--mybatis_-->
  9. <dependency>
  10. <groupId>org.mybatis</groupId>
  11. <artifactId>mybatis</artifactId>
  12. <version>3.5.3</version>
  13. </dependency>
  14. <!--分页插件-->
  15. <dependency>
  16. <groupId>com.github.pagehelper</groupId>
  17. <artifactId>pagehelper</artifactId>
  18. <version>5.1.2</version>
  19. </dependency>
  20. <!--mysql-->
  21. <dependency>
  22. <groupId>mysql</groupId>
  23. <artifactId>mysql-connector-java</artifactId>
  24. <version>5.1.46</version>
  25. </dependency>
  26. <!--druid数据源-->
  27. <dependency>
  28. <groupId>com.alibaba</groupId>
  29. <artifactId>druid</artifactId>
  30. <version>1.1.21</version>
  31. </dependency>
  32. <!--junit-->
  33. <dependency>
  34. <groupId>junit</groupId>
  35. <artifactId>junit</artifactId>
  36. <version>4.12</version>
  37. <scope>test</scope>
  38. </dependency>
  39. <!-- servlet3.0 -->
  40. <dependency>
  41. <groupId>javax.servlet</groupId>
  42. <artifactId>javax.servlet-api</artifactId>
  43. <version>3.1.0</version>
  44. <scope>provided</scope>
  45. </dependency>
  46. <!--jsp-->
  47. <dependency>
  48. <groupId>javax.servlet.jsp</groupId>
  49. <artifactId>javax.servlet.jsp-api</artifactId>
  50. <version>2.3.3</version>
  51. <scope>provided</scope>
  52. </dependency>
  53. <!--bean-utils-->
  54. <dependency>
  55. <groupId>commons-beanutils</groupId>
  56. <artifactId>commons-beanutils</artifactId>
  57. <version>1.9.4</version>
  58. </dependency>
  59. <!--apache工具包-->
  60. <dependency>
  61. <groupId>org.apache.commons</groupId>
  62. <artifactId>commons-lang3</artifactId>
  63. <version>3.9</version>
  64. </dependency>
  65. <!--jstl-->
  66. <dependency>
  67. <groupId>jstl</groupId>
  68. <artifactId>jstl</artifactId>
  69. <version>1.2</version>
  70. </dependency>
  71. <!--jackson-->
  72. <dependency>
  73. <groupId>com.fasterxml.jackson.core</groupId>
  74. <artifactId>jackson-annotations</artifactId>
  75. <version>2.9.0</version>
  76. </dependency>
  77. <dependency>
  78. <groupId>com.fasterxml.jackson.core</groupId>
  79. <artifactId>jackson-core</artifactId>
  80. <version>2.9.0</version>
  81. </dependency>
  82. <dependency>
  83. <groupId>com.fasterxml.jackson.core</groupId>
  84. <artifactId>jackson-databind</artifactId>
  85. <version>2.9.0</version>
  86. </dependency>
  87. <!--文件上传-->
  88. <dependency>
  89. <groupId>commons-fileupload</groupId>
  90. <artifactId>commons-fileupload</artifactId>
  91. <version>1.3.1</version>
  92. </dependency>
  93. <!--POI-->
  94. <dependency>
  95. <groupId>org.apache.poi</groupId>
  96. <artifactId>poi</artifactId>
  97. <version>4.0.1</version>
  98. </dependency>
  99. <dependency>
  100. <groupId>org.apache.poi</groupId>
  101. <artifactId>poi-ooxml</artifactId>
  102. <version>4.0.1</version>
  103. </dependency>
  104. <dependency>
  105. <groupId>org.apache.poi</groupId>
  106. <artifactId>poi-ooxml-schemas</artifactId>
  107. <version>4.0.1</version>
  108. </dependency>
  109. </dependencies>
  110.  
  111. <build>
  112. <plugins>
  113. <!--tomcat插件-->
  114. <plugin>
  115. <groupId>org.apache.tomcat.maven</groupId>
  116. <artifactId>tomcat7-maven-plugin</artifactId>
  117. <version>2.1</version>
  118. <configuration>
  119. <port>80</port>
  120. <path>/</path>
  121. <uriEncoding>utf-8</uriEncoding>
  122. </configuration>
  123. </plugin>
  124. </plugins>
  125. </build>

 

版权声明:本文为859630097com原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/859630097com/p/14504907.html