今天学习了Spring框架的入门,然后做练习遇到很多小bug,记录一下
1.cvc-complex-type.2.4.d: Invalid content was found starting with element 'bean'. No child element is expected at this point.标签中没有定义该子标签
2.Bean Definition Parsing Exception(Bean定义解析异常)
<bean id="名字随便取你用着方便就行" class="类的全路径">
例如:
<bean id="user" class="com.yc.bean.UesrBean">//鼠标定位到class属性值上,路径正确就可以定位
到该类
3.org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'board'
available:在对应的xml文件中没有bean的id为'board'
4.org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing Offending resource: class path resource [IOC01.xml] Bean 'board'; nested exception is
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration
解答:bean中忘记写class属性值了
5.Spring中list标签里面的值默认的类型为java.lang.String
6.用构造方法注入空属性值和创建空值<null></null>
构造函数给属性赋空值任然会创建对象,且对象不等价null