<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.3.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
</beans>
  
<!------------------------------上面就是模板-----------------------------> <?xml version="1.0" encoding="UTF-8"?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.3.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 就回去扫描这个包 看哪些类有@Component注解.... 然后就会自动加入到ioc容器中 -->
<context:component-scan base-package="包名"></context:component-scan> <bean id="" class="类的完整路径(包名+类名)"></bean> <!-- 使用默认构造函数 -->
<!-- 有几个属性就写几个<property> -->
<bean id="" class="">
<property name="" value=""></property> <!-- 默认调用 set() -->
<!-- 两种方式都可以
<property name="">
<value></value>
</property>
-->
</bean> <!-- 有几个constructor-arg 就回去调用相应的 构造函数 尽量吧name(属性名)属性写上 -->
<bean id="" class="">
<constructor-arg name="" value=""></constructor-arg>
</bean> <!-- p 命名空间 -->
<bean id="" class="“ p:属性="属性值"></bean> <!-- aop -->
<bean id="addStudent" class="com.service.AddStudent"></bean>
<bean id="logBefore" class="com.aop.LogBefore"></bean>
<aop:config>
<!-- expression里面是普通具体的普通方法 包+类+参数类型的具体类
expression=""可以写多个 e.g.
expression="execution( ) or execution()"
-->
<aop:pointcut expression="execution(public void com.service.AddStudent.addStudent())" id="pointcut"/> <!-- 切点 -->
<aop:advisor advice-ref="logBefore" pointcut-ref="pointcut"/> <!-- 切面 连接 -->
</aop:config>
</beans>

  

applicationContext.xml 模板的更多相关文章

  1. ApplicationContext.xml模板

      <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www. ...

  2. spring applicationContext.xml详解及模板

    applicationContext.xml 文件   1.<context:component-scan base-package="com.eduoinfo.finances.ba ...

  3. applicationContext.xml简单笔记

    applicationContext.xml简单笔记 <?xml version="1.0" encoding="UTF-8"?> <bean ...

  4. applicationContext-mail.xml 模板

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  5. applicationContext.xml配置简介

    这里简单介绍一下spring的配置文件applicationContext.xml中的一些配置的作用. <context:component-scan base-package="&q ...

  6. spring applicationContext.xml和hibernate.cfg.xml设置

    applicationContext.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans ...

  7. 为什么applicationContext.xml和spring-servlet.xml中都有注解过滤<context:component-scan base-package="myproject"> 和<context:component-scan base-package="myproject.controller" />

    在刚学习SpringMVC框架整合时,你也许会产生疑问为什么Spring.xml和SpringMVC.xml中都有注解过滤. <context:component-scan base-packa ...

  8. 项目中运行报错: Loading XML bean definitions from class path resource [applicationContext.xml]

    记录一下: org.springframework.context.support.AbstractApplicationContext prepareRefresh Refreshing org.s ...

  9. web.xml配置错误导致applicationContext.xml配置重复加载

    web.xml相关配置 <context-param><param-name>log4jRefreshInterval</param-name><param- ...

随机推荐

  1. NLog简单使用

    一.安装 二.安装后会在根目录出现NLog.config配置文件,简单修改配置文件为写入文件记录日志: <?xml version="1.0" encoding=" ...

  2. c/c++拷贝构造函数和关键字explicit

    c/c++拷贝构造函数和关键字explicit 关键字explicit 修饰构造方法的关键字,加上了,就告诉编译器,不可以隐式初始化对象:不加就可以隐式初始化对象: 下面的代码是可以正常编译执行的,但 ...

  3. Scrapy (网络爬虫框架)入门

    一.Scrapy 简介: Scrapy是用纯Python实现一个为了爬取网站数据.提取结构性数据而编写的应用框架,Scrapy 使用了 Twisted['twɪstɪd](其主要对手是Tornado) ...

  4. [HBase_3] HBase 命令

    0. 说明 1. HBase 命令 1.1 HBase 与 SQL 的区别 1.2 合并 HBase 中的小文件 major_compact 'test:t1' 1.3 删除数据的区别 HBase 在 ...

  5. LeetCode算法题-Add Digits(Java实现-3种解法)

    这是悦乐书的第199次更新,第207篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第63题(顺位题号是258).给定非负整数num,重复添加其所有数字,直到结果只有一位数 ...

  6. 【JXOI2018】守卫

    [JXOI2018]守卫 参考题解:https://blog.csdn.net/dofypxy/article/details/80196942 大致思路就是:区间DP.对于\([l,r]\)的答案, ...

  7. 设计模式のFacadePattern(外观模式)----结构模式

    一.产生背景 外观模式(Facade Pattern)隐藏系统的复杂性,并向客户端提供了一个客户端可以访问系统的接口.这种类型的设计模式属于结构型模式,它向现有的系统添加一个接口,来隐藏系统的复杂性. ...

  8. zuul超时问题

    转载:http://blog.csdn.net/tianyaleixiaowu/article/details/78772269 是这样的,今天碰到了微服务响应超时问题,而且超时时间特别短,2秒就超时 ...

  9. UVA1471-Defense Lines(思维+STL)

    Problem UVA1471-Defense Lines Accept: 297  Submit: 2776Time Limit: 9000 mSec Problem Description Aft ...

  10. Python之Requests库的异常

    异常                        说明                                     requests.ConnectionError 网络链接错误一场,如 ...