Spring随笔3

来源:互联网 发布:mac打开csgo黑屏 编辑:程序博客网 时间:2024/06/05 17:23
时间 内容 10.28 单元测试 错误总结

1、applicationContext.xml中引用Spring多个Schema空间的格式定义文件的错误

原代码文件(部分)

xsi:schemaLocation="http://www.springframework.org/schema/beans                    http://www.springframework.org/schema/beans/spring-beans-4.2.1.xsd                    http://www.springframework.org/schema/context                    http://www.springframework.org/schema/context/spring-context-4.2.1.xsd

修改后的代码文件

xsi:schemaLocation="http://www.springframework.org/schema/beans                    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd                    http://www.springframework.org/schema/context                    http://www.springframework.org/schema/context/spring-context-4.0.xsd

http://www.springframework.org/schema/beans/spring-beans-4.2.1.xsd声明空间不能被找到,故而造成了错误。

附一个完整的Spring配置文件:(感谢老司机high_great.cheng的帮助)

<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:task="http://www.springframework.org/schema/task" xmlns:p="http://www.springframework.org/schema/p"xmlns:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util"xsi:schemaLocation="http://www.springframework.org/schema/beans                    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd                    http://www.springframework.org/schema/context                    http://www.springframework.org/schema/context/spring-context-4.0.xsd                    http://www.springframework.org/schema/tx                    http://www.springframework.org/schema/tx/spring-tx-4.0.xsd                    http://www.springframework.org/schema/aop                    http://www.springframework.org/schema/aop/spring-aop-4.0.xsd                    http://www.springframework.org/schema/task                    http://www.springframework.org/schema/task/spring-task-4.0.xsd                    http://www.springframework.org/schema/jee                    http://www.springframework.org/schema/jee/spring-jee-4.0.xsd                    http://www.springframework.org/schema/util                    http://www.springframework.org/schema/util/spring-util-4.0.xsd">

2、jar包缺失

在引入jar包时缺少了aopalliance-1.0.jar和aspectjweaver-1.8.7.jar等两个jar包

3、SQL语句错误

在编写代码时,由于SQL语句过长,于是用字符串的拼接方式来完成SQL语句的书写,但是在“+”前后却忘记了空格,出现了类似下面的错误:

正确写法:

SELECT * FROM tablename where seclect_name ="name";

错误写法:

"SELECT * FROM tablename"+"where seclect_name =‘name’;"拼接完成后SELECT * FROM tablenamewhere seclect_name ="name";

4、未知bug

删除错误句,重新写一下就好了

0 0
原创粉丝点击