当前位置: 代码迷 >> 综合 >> spring3.x使用经验总结
  详细解决方案

spring3.x使用经验总结

热度:6   发布时间:2023-12-16 11:39:19.0


在实际应用中,根据作者的经验对spring进行了如下总结

1. spring常用tag



context:property-placeholder :加载app配置文件,注意注入参数的名称不要含特殊的名字,否则参数会被替换


context:annotation-config:容器启动加载action类中自动注入的类对象,并且传递注入,否则不会传递注入


context:component-scan:  容器启动加载指定包下的URL映射类


2. spring url-pattern / 与/*的区别


/ 模式 : 可以直接访问jsp ,也可以访问spring mapper URL


/* 模式: 只能访问spring mapper URL


3.spring配置结构模板:

spring-config.xml -参数入口 导入spring-config-dao.xml ....等。

spring-config-dao.xml

spring-config-service.xml

spring-config-datasource.xml

  相关解决方案