在spring框架的学习中,最重要的是学会如何从其已经有的包中我们拿出来使用,在这里,为了以后自己忘记spring约束的导入,将导入约束的步骤写下。
第一步:选择windows–>prefences–>xml catalog–>add–>location下的file system在里面添加spring-framework-4.2.4.RELEASE/schema/beans/spring-beans-4.2.xsd
Key type选择schema location
Key:将location中导入的约束文件spring-beans-4.2.xsd放在beans后面,最后结果显示如图:
spring约束导入步骤
第二步:将添加好的约束文件应用并关闭后,新建一个applicationContext.xml文件,文件名没有要求,在xml文件中写上根元素,将文件的视图转换为Design视图,如下
spring约束导入步骤
选中beans元素右键–>Edit Namesspace–>Add–>xsi(这个是必须要选择的)
选中beans元素右键–>Edit Namesspace–>Add–>specify new Namespace–>location hint–>selcect xml catalog entry–>选中在第一步中生成的key。如图
spring约束导入步骤
为了检验是否将约束导入成功,我们在xml文件中alt+/会出现如下图所示的提示就代表约束导入成功。
spring约束导入步骤
至于在spring项目搭建中的导包和创建对象,我们只需要从下载的spring包中找到我们需要用的包并导入项目中即可。

相关文章:

  • 2022-01-20
  • 2021-11-11
  • 2021-04-21
  • 2022-12-23
  • 2021-05-01
  • 2022-12-23
  • 2021-08-11
  • 2021-09-05
猜你喜欢
  • 2021-04-02
  • 2021-05-29
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2021-11-03
相关资源
相似解决方案