IDEA中编写spring配置文件命名空间无法自动导入问题----------最简单实用的方法

1.常用的命名空间
第一种方式是将常用的命名空间都记录下来,需要时复制黏贴导入,但现在此种方式不建议。
1.util标签用来配置集合、常量等的
xmlns:util="http://www.springframework.org/schema/util"
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd


2.jee标签用来处理javaee标准相关的问题,例如查询一个jndi对象以及定义一个ejb的引用等  
xmlns:jee="http://www.springframework.org/schema/jee"   
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd


3.lang用来将那些已经被定义在一些动态语言(例如Jruby和Groovy)中的对象作为beans中的对象存放到spring容器中
xmlns:lang="http://www.springframework.org/schema/lang"
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd


4.jms :
xmlns:jms="http://www.springframework.org/schema/jms"
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd

5.aop :
xmlns:aop="http://www.springframework.org/schema/aop"   
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd

6.context 
xmlns:context="http://www.springframework.org/schema/context"
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd

7.jdbc
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd

8.cache 
xmlns:jdbc="http://www.springframework.org/schema/cache"
http://www.springframework.org/schema/cache http://www.springframework.org/schema/jdbc/spring-cache.xsd

9.tx (transaction事务管理) 使用时建议配合aop:
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd

10.p命名空间,进行简化bean的创建,属性的注入书写方式
xmlns:p="http://www.springframework.org/schema/p"

11.mybatis-spring
xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd


12.mvc
xmlns:mvc=”http://www.springframework.org/schema/mvc”
xsi:schemaLocation=”http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
2使用IDEA的自动提示补全命名空间
在没有导入相应命名空间的情况下,可以直接在配置文件中直接使用相应的命名空间,
IDEA会根据你的使用直接导入对应的命名空间。
如下:在未导入aop命名空间的情况下,直接使用该命名空间下的标签。
1
2
3


经使用IDEA的提示,可以自动补全aop的命名空间。
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值