Spring 注解配置 WebApplicationContext
2024-09-05 22:42:23
https://docs.spring.io/spring-framework/docs/4.3.9.RELEASE/spring-framework-reference/htmlsingle/#beans-custom-autowire-configurer
<web-app>
<!-- Configure ContextLoaderListener to use AnnotationConfigWebApplicationContext
instead of the default XmlWebApplicationContext -->
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param> <!-- Configuration locations must consist of one or more comma- or space-delimited
fully-qualified @Configuration classes. Fully-qualified packages may also be
specified for component-scanning -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.acme.AppConfig</param-value>
</context-param> <!-- Bootstrap the root application context as usual using ContextLoaderListener -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> <!-- Declare a Spring MVC DispatcherServlet as usual -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- Configure DispatcherServlet to use AnnotationConfigWebApplicationContext
instead of the default XmlWebApplicationContext -->
<init-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</init-param>
<!-- Again, config locations must consist of one or more comma- or space-delimited
and fully-qualified @Configuration classes -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.acme.web.MvcConfig</param-value>
</init-param>
</servlet> <!-- map all requests for /app/* to the dispatcher servlet -->
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
</web-app>
最新文章
- SOAPUI使用教程-MockOperations和响应
- 转载:javascript 拖拽排序,简洁示例备忘
- reverse string | leetcode
- 雅虎工程师初始化css
- IOS 取值控件(UIPicker)的使用方法
- 字符串模式匹配KMP算法
- junit4X系列源码--总体介绍
- Carries SCU - 4437
- [MySQL]InnoDB引擎的行锁和表锁
- 谈谈 iOS 中图片的解压缩
- Python connect mariadb(Python连接mysql)
- 使用vue+koa实现一个简单的图书小程序(1)
- scala 模式匹配详解 3 模式匹配的核心功能是解构
- 简单测试--C#实现中文汉字转拼音首字母
- 在 OSX 下使用 supervisor 管理服务
- ps -ef | grep 查看进程命令
- Try Before Choosing
- python开发_tkinter_获取文本框内容_给文本框添加键盘输入事件
- Android ScrollView 子控件不占满的问题
- Day20-单表中获取表单数据的3种方式
热门文章
- python中pycharm中.py文件调用一个.py文件的函数
- ubuntu终端代理之proxychains
- winCE 获取路径信息
- MIT 6.824学习笔记3 Go语言并发解析
- javascript中无法将string转化为json对象
- JavaScript基础1——在末尾添加节点
- vue函数防抖和节流
- 封装和private,this,super关键字的简单应用
- [资料] 常见的IC芯片解密方法与原理解析!
- Codeforces Round #340 (Div. 2) E. XOR and Favorite Number (莫队)