• SSM整合


    一:ContextLoaderListener

    Spring提供了监听器ContextLoaderListener,实现ServletContextListener接口,可监听 ServletContext的状态,在web服务器的启动,读取Spring的配置文件,创建Spring的IOC容器。web 应用中必须在web.xml中配置

    1. <listener>
    2. <listener-class>org.springframework.web.context.ContextLoaderListenerlistener-class>
    3. listener>
    4. <context-param>
    5. <param-name>contextConfigLocationparam-name>
    6. <param-value>classpath:spring.xmlparam-value>
    7. context-param>

    二:准备工作

    ①创建Maven Module

    ②导入依赖

    1. <packaging>warpackaging>
    2. <properties>
    3. <spring.version>5.3.23spring.version>
    4. properties>
    5. <dependencies>
    6. <dependency>
    7. <groupId>org.springframeworkgroupId>
    8. <artifactId>spring-contextartifactId>
    9. <version>${spring.version}version>
    10. dependency>
    11. <dependency>
    12. <groupId>org.springframeworkgroupId>
    13. <artifactId>spring-beansartifactId>
    14. <version>${spring.version}version>
    15. dependency>
    16. <dependency>
    17. <groupId>org.springframeworkgroupId>
    18. <artifactId>spring-webartifactId>
    19. <version>${spring.version}version>
    20. dependency>
    21. <dependency>
    22. <groupId>org.springframeworkgroupId>
    23. <artifactId>spring-webmvcartifactId>
    24. <version>${spring.version}version>
    25. dependency>
    26. <dependency>
    27. <groupId>org.springframeworkgroupId>
    28. <artifactId>spring-jdbcartifactId>
    29. <version>${spring.version}version>
    30. dependency>
    31. <dependency>
    32. <groupId>org.springframeworkgroupId>
    33. <artifactId>spring-aspectsartifactId>
    34. <version>${spring.version}version>
    35. dependency>
    36. <dependency>
    37. <groupId>org.springframeworkgroupId>
    38. <artifactId>spring-testartifactId>
    39. <version>${spring.version}version>
    40. dependency>
    41. <dependency>
    42. <groupId>org.mybatisgroupId>
    43. <artifactId>mybatisartifactId>
    44. <version>3.5.11version>
    45. dependency>
    46. <dependency>
    47. <groupId>org.mybatisgroupId>
    48. <artifactId>mybatis-springartifactId>
    49. <version>2.0.6version>
    50. dependency>
    51. <dependency>
    52. <groupId>com.alibabagroupId>
    53. <artifactId>druidartifactId>
    54. <version>1.0.9version>
    55. dependency>
    56. <dependency>
    57. <groupId>junitgroupId>
    58. <artifactId>junitartifactId>
    59. <version>4.12version>
    60. <scope>testscope>
    61. dependency>
    62. <dependency>
    63. <groupId>mysqlgroupId>
    64. <artifactId>mysql-connector-javaartifactId>
    65. <version>8.0.29version>
    66. dependency>
    67. <dependency>
    68. <groupId>log4jgroupId>
    69. <artifactId>log4jartifactId>
    70. <version>1.2.17version>
    71. dependency>
    72. <dependency>
    73. <groupId>com.github.pagehelpergroupId>
    74. <artifactId>pagehelperartifactId>
    75. <version>5.2.0version>
    76. dependency>
    77. <dependency>
    78. <groupId>ch.qos.logbackgroupId>
    79. <artifactId>logback-classicartifactId>
    80. <version>1.2.3version>
    81. dependency>
    82. <dependency>
    83. <groupId>javax.servletgroupId>
    84. <artifactId>javax.servlet-apiartifactId>
    85. <version>3.1.0version>
    86. <scope>providedscope>
  • 相关阅读:
    vue-cli解决IE浏览器chunk-vendors.js 提示sockjs-client错误
    【Python大数据笔记_day10_Hive调优及Hadoop进阶】
    Ubantu 20.04 卸载与安装 MySQL 5.7 详细教程
    Linux命令
    无重复字符的最长子串
    MMDetection在ScanNet上训练
    低空经济和无人机
    外贸老鸟帮新人点评、修改的5个开发信案例
    最长连续序列(LeetCode128)
    pytorch中 torch.utils.data的用法 ----加载数据篇
  • 原文地址:https://blog.csdn.net/m0_56379670/article/details/127714281