• spring01


    目录

    一、对spring的理解

    二、spring中ioc的特点

    2.1控制反转

     2.2注入依赖

    方式① set注入

     方式② 构造注入

    方式③ 自动装配

    三、spring与web容器的整合

    一、对spring的理解

    spring是一个开源框架,它由Rod Johnson 创建。它是为了解决企业应用开发的复杂性而创建的。

    目的:解决企业应用开发的复杂性

    功能:使用基本的JavaBean代替EJB,并提供了更多的企业应用功能

    范围:任何Java应用

    简单来说,Spring是一个轻量级的控制反转(IoC)和面向切面(AOP)的容器框架。

    二、spring中ioc的特点

    建一个maven项目

    pom.xml

    1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    3. <modelVersion>4.0.0modelVersion>
    4. <groupId>com.cdlgroupId>
    5. <artifactId>T280_springartifactId>
    6. <packaging>warpackaging>
    7. <version>0.0.1-SNAPSHOTversion>
    8. <name>T280_spring Maven Webappname>
    9. <url>http://maven.apache.orgurl>
    10. <properties>
    11. <spring.version>5.0.1.RELEASEspring.version>
    12. <javax.servlet.version>4.0.0javax.servlet.version>
    13. <junit.version>4.12junit.version>
    14. properties>
    15. <dependencies>
    16. <dependency>
    17. <groupId>junitgroupId>
    18. <artifactId>junitartifactId>
    19. <version>3.8.1version>
    20. <scope>testscope>
    21. dependency>
    22. <dependency>
    23. <groupId>org.springframeworkgroupId>
    24. <artifactId>spring-contextartifactId>
    25. <version>${spring.version}version>
    26. dependency>
    27. <dependency>
    28. <groupId>org.springframeworkgroupId>
    29. <artifactId>spring-aspectsartifactId>
    30. <version>${spring.version}version>
    31. dependency>
    32. <dependency>
    33. <groupId>junitgroupId>
    34. <artifactId>junitartifactId>
    35. <version>${junit.version}version>
    36. <scope>testscope>
    37. dependency>
    38. <dependency>
    39. <groupId>javax.servletgroupId>
    40. <artifactId>javax.servlet-apiartifactId>
    41. <version>${javax.servlet.version}version>
    42. <scope>providedscope>
    43. dependency>
    44. dependencies>
    45. <build>
    46. <finalName>T280_springfinalName>
    47. <plugins>
    48. <plugin>
    49. <groupId>org.apache.maven.pluginsgroupId>
    50. <artifactId>maven-compiler-pluginartifactId>
    51. <version>3.7.0version>
    52. <configuration>
    53. <source>1.8source>
    54. <target>1.8target>
    55. <encoding>UTF-8encoding>
    56. configuration>
    57. plugin>
    58. plugins>
    59. build>
    60. project>

    web.xml

    1. <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    4. version="3.1">
    5. <display-name>Archetype Created Web Applicationdisplay-name>
    6. web-app>

    2.1控制反转

    建一个com.cdl.biz的包

    UserBiz

    1. package com.cdl.biz;
    2. /**
    3. * 用户业务类
    4. * @author Lenovo
    5. *
    6. */
    7. public interface UserBiz {
    8. void list();
    9. }

    建一个com.cdl.biz.impl的包

    UserBizImpl1

    1. package com.cdl.biz.impl;
    2. import com.cdl.biz.UserBiz;
    3. public class UserBizImpl1 implements UserBiz{
    4. @Override
    5. public void list() {
    6. System.out.println("查询用户数据。。按照年龄排序。");
    7. }
    8. }

    UserBizImpl2

    1. package com.cdl.biz.impl;
    2. import com.cdl.biz.UserBiz;
    3. public class UserBizImpl2 implements UserBiz{
    4. @Override
    5. public void list() {
    6. System.out.println("查询用户数据。。按照入职时间排序。");
    7. }
    8. }

    建一个com.cdl.web的包

    OrderAction

    1. package com.cdl.web;
    2. import com.cdl.biz.UserBiz;
    3. import com.cdl.biz.impl.UserBizImpl1;
    4. public class OrderAction {
    5. private UserBiz userBiz = new UserBizImpl1();
    6. public void list() {
    7. userBiz.list();
    8. }
    9. }

    UserAction

    1. package com.cdl.web;
    2. import com.cdl.biz.UserBiz;
    3. import com.cdl.biz.impl.UserBizImpl1;
    4. public class UserAction {
    5. private UserBiz userBiz = new UserBizImpl1();
    6. public void list() {
    7. userBiz.list();
    8. }
    9. }

    常规做法即运用spring之前的处理方法

    * 需求:
     * 同时在用户模块,订单模块拿到所有的用户数据
     * 
     * 需求变更1:
     * 同时在用户模块,订单模块拿到所有的用户数据,并且要求用户数据是通过年龄排序的
     * 对应策略:修改UserBiz中list方法,添加排序功能
     * 
     * 需求变更2:
     * 同时在用户模块,订单模块拿到所有的用户数据,并且要求用户数据是通过注册时间排序的
     * 对应策略,修改UserBiz中list方法,添加排序功能,按照时间点排序

     总结:
     * 最原始:频繁修改业务层biz的代码
     * 多实现:凡是涉及到用户业务层调用的地方,都需要修改代码

    运用spring处理

     将spring的配置文件加入

    spring-context.xml

    1. <beans xmlns="http://www.springframework.org/schema/beans"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns:aop="http://www.springframework.org/schema/aop"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    8. beans>

    注意:一定要在有网络的情况下进行,否则约束不生效

    IOC的主要作用管理整个项目的Javabean:依靠依赖注入、控制反转的特点进行管理

     spring-context.xml

    1. <beans xmlns="http://www.springframework.org/schema/beans"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns:aop="http://www.springframework.org/schema/aop"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    8. <bean class="com.cdl.biz.impl.UserBizImpl2" id="userBiz2">bean>
    9. <bean class="com.cdl.web.UserAction" id="userAction">
    10. <property name="userBiz" ref="userBiz2">property>
    11. bean>
    12. <bean class="com.cdl.web.OrderAction" id="orderAction">bean>
    13. beans>

    UserAction

    1. package com.cdl.web;
    2. import com.cdl.biz.UserBiz;
    3. import com.cdl.biz.impl.UserBizImpl1;
    4. public class UserAction {
    5. //private UserBiz userBiz = new UserBizImpl1();
    6. private UserBiz userBiz;
    7. public void list() {
    8. userBiz.list();
    9. }
    10. public UserBiz getUserBiz() {
    11. return userBiz;
    12. }
    13. public void setUserBiz(UserBiz userBiz) {
    14. this.userBiz = userBiz;
    15. }
    16. }

    建一个com.cdl.ioc的包

    在里面建一个Demo1的类

    建模,打印com.cdl.biz.impl.UserBizImpl2中的语句

    1. package com.cdl.ioc;
    2. import org.springframework.context.support.ClassPathXmlApplicationContext;
    3. import com.cdl.web.UserAction;
    4. public class Demo1 {
    5. @SuppressWarnings("resource")
    6. public static void main(String[] args) {
    7. //建模
    8. ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/spring-context.xml");
    9. UserAction userAction = (UserAction) context.getBean("userAction");
    10. userAction.list();
    11. }
    12. }

     运行结果:

     可见 能拿到

    总结

    1.对spring框架的配置文件进行建模,建模之后spring-context.xml中所有的Javabean信息
     都会加载进spring容器的上下文中
     2.上下文中就包含了spring-context.xml 所有对象

     测试orderaction也拿到相同结果,配置和orderaction都如useraction一致修改

    1. package com.cdl.web;
    2. import com.cdl.biz.UserBiz;
    3. import com.cdl.biz.impl.UserBizImpl1;
    4. public class OrderAction {
    5. //private UserBiz userBiz = new UserBizImpl1();
    6. private UserBiz userBiz;
    7. public void list() {
    8. userBiz.list();
    9. }
    10. public UserBiz getUserBiz() {
    11. return userBiz;
    12. }
    13. public void setUserBiz(UserBiz userBiz) {
    14. this.userBiz = userBiz;
    15. }
    16. }

    1. <beans xmlns="http://www.springframework.org/schema/beans"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns:aop="http://www.springframework.org/schema/aop"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    8. <bean class="com.cdl.biz.impl.UserBizImpl2" id="userBiz2">bean>
    9. <bean class="com.cdl.web.UserAction" id="userAction">
    10. <property name="userBiz" ref="userBiz2">property>
    11. bean>
    12. <bean class="com.cdl.web.OrderAction" id="orderAction">
    13. <property name="userBiz" ref="userBiz2">property>
    14. bean>
    15. beans>
    1. package com.cdl.ioc;
    2. import org.springframework.context.support.ClassPathXmlApplicationContext;
    3. import com.cdl.web.OrderAction;
    4. import com.cdl.web.UserAction;
    5. /**
    6. * 1.对spring框架的配置文件进行建模,建模之后spring-context.xml中所有的Javabean信息
    7. * 都会加载进spring容器的上下文中
    8. * 2.上下文中就包含了spring-context.xml 所有对象
    9. * @author Lenovo
    10. *
    11. */
    12. public class Demo1 {
    13. @SuppressWarnings("resource")
    14. public static void main(String[] args) {
    15. //建模
    16. ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/spring-context.xml");
    17. UserAction userAction = (UserAction) context.getBean("userAction");
    18. userAction.list();
    19. OrderAction orderAction = (OrderAction) context.getBean("orderAction");
    20. orderAction.list();
    21. }
    22. }

    结果:

     若是要按年龄排序,就只需要修改配置文件就OK了

    1. <beans xmlns="http://www.springframework.org/schema/beans"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns:aop="http://www.springframework.org/schema/aop"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    8. <bean class="com.cdl.biz.impl.UserBizImpl1" id="userBiz2">bean>
    9. <bean class="com.cdl.web.UserAction" id="userAction">
    10. <property name="userBiz" ref="userBiz2">property>
    11. bean>
    12. <bean class="com.cdl.web.OrderAction" id="orderAction">
    13. <property name="userBiz" ref="userBiz2">property>
    14. bean>
    15. beans>

     结论:IOC特点(控制反转):将创建对象的权利反转给spring容器来完成

     2.2注入依赖

    方式① set注入

     

     可见报错的原因就是找不到set的方法

    接下来用一个例子(多注入三个属性)来更深入的了解

    UserAction

    1. package com.cdl.web;
    2. import java.util.List;
    3. import com.cdl.biz.UserBiz;
    4. import com.cdl.biz.impl.UserBizImpl1;
    5. public class UserAction {
    6. //private UserBiz userBiz = new UserBizImpl1();
    7. private UserBiz userBiz;
    8. public UserBiz getUserBiz() {
    9. return userBiz;
    10. }
    11. public void setUserBiz(UserBiz userBiz) {
    12. this.userBiz = userBiz;
    13. }
    14. private String name;
    15. private int age;
    16. private List hobby;
    17. public String getName() {
    18. return name;
    19. }
    20. public void setName(String name) {
    21. this.name = name;
    22. }
    23. public int getAge() {
    24. return age;
    25. }
    26. public void setAge(int age) {
    27. this.age = age;
    28. }
    29. public List getHobby() {
    30. return hobby;
    31. }
    32. public void setHobby(List hobby) {
    33. this.hobby = hobby;
    34. }
    35. public void list() {
    36. System.out.println(name);
    37. System.out.println(age);
    38. System.out.println(hobby);
    39. userBiz.list();
    40. }
    41. }
    1. <beans xmlns="http://www.springframework.org/schema/beans"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns:aop="http://www.springframework.org/schema/aop"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    8. <bean class="com.cdl.biz.impl.UserBizImpl1" id="userBiz2">bean>
    9. <bean class="com.cdl.web.UserAction" id="userAction">
    10. <property name="userBiz" ref="userBiz2">property>
    11. <property name="age" value="22">property>
    12. <property name="name" value="cdl">property>
    13. <property name="hobby">
    14. <list>
    15. <value>篮球value>
    16. <value>足球value>
    17. <value>唱歌value>
    18. list>
    19. property>
    20. bean>
    21. <bean class="com.cdl.web.OrderAction" id="orderAction">
    22. <property name="userBiz" ref="userBiz2">property>
    23. bean>
    24. beans>
    1. package com.cdl.ioc;
    2. import org.springframework.context.support.ClassPathXmlApplicationContext;
    3. import com.cdl.web.OrderAction;
    4. import com.cdl.web.UserAction;
    5. /**
    6. * 1.对spring框架的配置文件进行建模,建模之后spring-context.xml中所有的Javabean信息
    7. * 都会加载进spring容器的上下文中
    8. * 2.上下文中就包含了spring-context.xml 所有对象
    9. * @author Lenovo
    10. *
    11. * IOC特点(控制反转):将创建对象的权利反转给spring容器来完成
    12. *
    13. *
    14. */
    15. public class Demo1 {
    16. @SuppressWarnings("resource")
    17. public static void main(String[] args) {
    18. //建模
    19. ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/spring-context.xml");
    20. UserAction userAction = (UserAction) context.getBean("userAction");
    21. userAction.list();
    22. OrderAction orderAction = (OrderAction) context.getBean("orderAction");
    23. orderAction.list();
    24. }
    25. }

    结果:

     方式② 构造注入

    OrderAction

    1. package com.cdl.web;
    2. import java.util.List;
    3. import com.cdl.biz.UserBiz;
    4. import com.cdl.biz.impl.UserBizImpl1;
    5. /**
    6. * 依赖注入的三种方式:
    7. * 1.set注入
    8. * 2.构造注入
    9. * 3.自动装配
    10. * byName
    11. * byType
    12. * @author Lenovo
    13. *
    14. */
    15. public class OrderAction {
    16. //private UserBiz userBiz = new UserBizImpl1();
    17. private UserBiz userBiz;
    18. public UserBiz getUserBiz() {
    19. return userBiz;
    20. }
    21. public void setUserBiz(UserBiz userBiz) {
    22. this.userBiz = userBiz;
    23. }
    24. private String name;
    25. private int age;
    26. private List hobby;
    27. public OrderAction(String name, int age, List hobby) {
    28. super();
    29. this.name = name;
    30. this.age = age;
    31. this.hobby = hobby;
    32. }
    33. public OrderAction() {
    34. super();
    35. // TODO Auto-generated constructor stub
    36. }
    37. public void list() {
    38. System.out.println(name);
    39. System.out.println(age);
    40. System.out.println(hobby);
    41. userBiz.list();
    42. }
    43. }
    1. <beans xmlns="http://www.springframework.org/schema/beans"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns:aop="http://www.springframework.org/schema/aop"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    8. <bean class="com.cdl.biz.impl.UserBizImpl1" id="userBiz2">bean>
    9. <bean class="com.cdl.web.UserAction" id="userAction">
    10. <property name="userBiz" ref="userBiz2">property>
    11. <property name="age" value="22">property>
    12. <property name="name" value="cdl">property>
    13. <property name="hobby">
    14. <list>
    15. <value>篮球value>
    16. <value>足球value>
    17. <value>唱歌value>
    18. list>
    19. property>
    20. bean>
    21. <bean class="com.cdl.web.OrderAction" id="orderAction">
    22. <property name="userBiz" ref="userBiz2">property>
    23. <constructor-arg name="name" value="cdl">constructor-arg>
    24. <constructor-arg name="age" value="23">constructor-arg>
    25. <constructor-arg name="hobby">
    26. <list>
    27. <value>篮球1value>
    28. <value>足球1value>
    29. <value>唱歌1value>
    30. list>
    31. constructor-arg>
    32. bean>
    33. beans>

    在Demo1运行

    方式③ 自动装配

    将set和构造的注入 注释

    byType不报错 byName报错

     

     

     

    byType报错 byName不报错

     

     

    自动装配
     default-autowire="byName" 
    byName:是通过spring管理的bean对象的ID进行查找,如果找不到,则注入失败,反之成功
     byType:是通过spring管理的bean对象的接口实现类进行查找,如果没有或者2个以上,则注入失败,反之成功

    三、spring与web容器的整合

    分析:

    spring与web容器的整合原理
        why:建模的过程是十分耗时的
      解决问题:
     1.建模必不可少
     2.建模只保障只执行一次
     3.建模后期望在每一个servlet都能够拿到spring的上下文对象ClassPathXmlApplicationContext
      how:
      1.监听器的初始化方法 只执行一次
      2.spring的上下文要存放在Tomcat上下文中

    建一个包com.cdl.ioc.listener

    1. package com.cdl.ioc.listener;
    2. import javax.servlet.ServletContext;
    3. import javax.servlet.ServletContextEvent;
    4. import javax.servlet.ServletContextListener;
    5. import org.springframework.context.support.ClassPathXmlApplicationContext;
    6. public class SpringLoadListener implements ServletContextListener{
    7. @Override
    8. public void contextInitialized(ServletContextEvent sce) {
    9. System.out.println("初始化执行");
    10. ServletContext servletContext = sce.getServletContext();
    11. String springConfigLocation = servletContext.getInitParameter("springConfigLocation");
    12. System.out.println(springConfigLocation+"...");
    13. //拿到spring上下文
    14. ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/spring-context.xml");
    15. //将spring的上下文保存在Tomcat上下文中
    16. servletContext.setAttribute("springContext", context);
    17. }
    18. }

    在com.cdl.ioc中建一个类DemoServlet

    1. package com.cdl.ioc;
    2. import java.io.IOException;
    3. import javax.servlet.ServletException;
    4. import javax.servlet.annotation.WebServlet;
    5. import javax.servlet.http.HttpServlet;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import org.springframework.context.support.ClassPathXmlApplicationContext;
    9. import com.cdl.web.UserAction;
    10. /**
    11. * spring与web容器的整合原理
    12. * why:建模的过程是十分耗时的
    13. * 解决问题:
    14. * 1.建模必不可少
    15. * 2.建模只保障只执行一次
    16. * 3.建模后期望在每一个servlet都能够拿到spring的上下文对象ClassPathXmlApplicationContext
    17. * how:
    18. * 1.监听器的初始化方法 只执行一次
    19. * 2.spring的上下文要存放在Tomcat上下文中
    20. * @author Lenovo
    21. *
    22. */
    23. @WebServlet("/springDemo")
    24. public class DemoServlet extends HttpServlet{
    25. @Override
    26. protected void service(HttpServletRequest arg0, HttpServletResponse arg1){
    27. //ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/spring-context.xml");
    28. ClassPathXmlApplicationContext context = (ClassPathXmlApplicationContext) arg0.getServletContext().getAttribute("springContext");
    29. UserAction userAction = (UserAction) context.getBean("userAction");
    30. userAction.list();
    31. }
    32. }

    spring-context.xml

    1. <beans xmlns="http://www.springframework.org/schema/beans"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xmlns:aop="http://www.springframework.org/schema/aop"
    4. xmlns:context="http://www.springframework.org/schema/context"
    5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    6. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    8. <bean class="com.cdl.biz.impl.UserBizImpl1" id="userBiz">bean>
    9. <bean class="com.cdl.biz.impl.UserBizImpl1" id="userBiz1">bean>
    10. <bean class="com.cdl.web.UserAction" id="userAction">
    11. <property name="userBiz" ref="userBiz1">property>
    12. <property name="age" value="22">property>
    13. <property name="name" value="cdl">property>
    14. <property name="hobby">
    15. <list>
    16. <value>篮球value>
    17. <value>足球value>
    18. <value>唱歌value>
    19. list>
    20. property>
    21. bean>
    22. <bean class="com.cdl.web.OrderAction" id="orderAction">
    23. <property name="userBiz" ref="userBiz1">property>
    24. <constructor-arg name="name" value="cdl">constructor-arg>
    25. <constructor-arg name="age" value="23">constructor-arg>
    26. <constructor-arg name="hobby">
    27. <list>
    28. <value>篮球1value>
    29. <value>足球1value>
    30. <value>唱歌1value>
    31. list>
    32. constructor-arg>
    33. bean>
    34. beans>

    web.xml

    1. <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    4. version="3.1">
    5. <display-name>Archetype Created Web Applicationdisplay-name>
    6. <context-param>
    7. <param-name>springConfigLocationparam-name>
    8. <param-value>/applicationContext.xmlparam-value>
    9. context-param>
    10. <listener>
    11. <listener-class>com.cdl.ioc.listener.SpringLoadListenerlistener-class>
    12. listener>
    13. web-app>

    结果:

  • 相关阅读:
    机器学习 —— 聚类算法
    P2E-Higtstreet
    逻辑回归的原理
    伦敦银如何选择最优的交易方法
    将折叠屏卖到5999元!但摩托罗拉razr 2022的看点不止性价比
    Python接口自动化 —— Json 数据处理实战(详解)
    数仓分层能减少重复计算,为啥能减少?如何减少?这篇文章包懂!
    详解ZStack 高性能网络方案以及性能对比测试
    金仓数据库 KDTS 迁移工具使用指南 (5. SHELL版使用说明)
    【计算机网络】第三章 链路层
  • 原文地址:https://blog.csdn.net/weixin_62735525/article/details/126164581