spring-event.xml 2.3 KB

12345678910111213141516171819202122232425262728293031
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
  4. xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx"
  5. xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  6. xmlns:task="http://www.springframework.org/schema/task"
  7. xsi:schemaLocation="
  8. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  9. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  10. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
  11. http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
  12. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
  13. http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
  14. http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"
  15. default-lazy-init="true">
  16. <task:executor id="executor" pool-size="10" />
  17. <!-- 名字必须是applicationEventMulticaster和messageSource是一样的,默认找这个名字的对象 -->
  18. <!-- 名字必须是applicationEventMulticaster,因为AbstractApplicationContext默认找个 -->
  19. <!-- 如果找不到就new一个,但不是异步调用而是同步调用 -->
  20. <bean id="applicationEventMulticaster" class="org.springframework.context.event.SimpleApplicationEventMulticaster">
  21. <!-- 注入任务执行器 这样就实现了异步调用(缺点是全局的,要么全部异步,要么全部同步(删除这个属性即是同步)) -->
  22. <!-- <property name="taskExecutor" ref="executor" /> -->
  23. </bean>
  24. <bean id="searchListener" class="com.fsm.cms.search.SearchListener" />
  25. <bean id="staticListener" class="com.fsm.cms.statics.StaticListener" />
  26. <!-- 用户角色关系发生变化时,同步至activiti -->
  27. <bean id="userRoleListener" class="com.fsm.workflow.UserRoleListener" />
  28. </beans>