spring——ApplicationContext.xml

https://docs.spring.io/spring-framework/docs/5.0.0.M5/spring-framework-reference/html/beans.html#beans-factory-xml-import

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xmlns:p="http://www.springframework.org/schema/p"
  7. xmlns:c="http://www.springframework.org/schema/c"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans.xsd
  10. http://www.springframework.org/schema/context
  11. http://www.springframework.org/schema/context/spring-context.xsd
  12. http://www.springframework.org/schema/aop
  13. https://www.springframework.org/schema/aop/spring-aop.xsd">
  14. <!-- 开启注解支持 -->
  15. <context:annotation-config/>
  16. <!-- 指定要扫描的包,这个包下的注解会生效 -->
  17. <context:component-scan base-package="com.xxx.xxx.xxx"/>
  18. <bean id="..." class="...">
  19. <!-- collaborators and configuration for this bean go here -->
  20. </bean>
  21. <bean id="..." class="...">
  22. <!-- collaborators and configuration for this bean go here -->
  23. </bean>
  24. <!-- more bean definitions go here -->
  25. </beans>