关于sping的xmlBeanFactory问题

daixj110 2010-03-18 08:09:44
我刚学sping的一个程序
总是说source not found the souce not contain the source for file XmlBeanDefinitionReader.class

源程序src/spring2/spingDemo.class
package spring2;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.core.io.*;
public class SpringDemo {
public static void main(String[] args)
{
Resource resource=new FileSystemResource("benas-config.xml");
BeanFactory factory=new XmlBeanFactory(resource);
HelloBean hello=(HelloBean)factory.getBean("helloBean");
System.out.println(hello.getHelloWord());
}
}

src/spring2/HelloBean.class
package spring2;

public class HelloBean {
private String helloWord;
public void setHelloWord(String helloword)
{
this.helloWord=helloWord;
}
public String getHelloWord()
{
return helloWord;
}
}


beans-config.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="helloBean" class="spring2.HelloBean">
<property name="helloWord">
<value>hello</value>
</property>
</bean></beans>


这是什么问题?

问题补充
这是debug下的 异常
XmlBeanDefinitionReader.loadBeanDefinitions(EncodedResource) line: 353
XmlBeanDefinitionReader.loadBeanDefinitions(Resource) line: 310
XmlBeanFactory.<init>(Resource, BeanFactory) line: 73
XmlBeanFactory.<init>(Resource) line: 61
SpringDemo.main(String[]) line: 9
...全文
241 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
daixj110 2010-03-18
  • 打赏
  • 举报
回复
拼写错误
1bean-config.xml
2set里的helloword改为helloWord
深夜情感老师 2010-03-18
  • 打赏
  • 举报
回复
调试就肯定能找出错误的
daixj110 2010-03-18
  • 打赏
  • 举报
回复
就得哪些异常
这是控制台的
class path resource [benas-config.xml]
2010-3-18 18:54:37 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [benas-config.xml]
aSysBang 2010-03-18
  • 打赏
  • 举报
回复
把全部异常都发出来呀 关键的cause by 都没看到。。。
估计xml文件问题

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧