在这个ApplicationContext.xml文件中出现 如下报错

Element : property

Bean definitions can have zero or more properties. Property elements correspond to JavaBean setter

methods exposed by the bean classes. Spring supports primitives, references to other beans in the same or

related factories, lists, maps and properties.

Content Model : (description?, (meta | bean | ref | idref | value | null | array | list | set | map | props |

namespace:uri="##other")?)

或者

Multiple annotations found at this line:

- No constructor with 0 arguments defined in class

'cn.lonecloud.bean.step08iocfieldbyProperty.UserBean'

请在自己导入的实体bean中检查是否没有加无参数的构造函数

package cn.lonecloud.bean.step08iocfieldbyProperty;

public class UserBean {

    private String userName;

    private int age;

    private String address;

    public String getUserName() {
return userName;
} public void setUserName(String userName) {
this.userName = userName;
} public int getAge() {
return age;
} public void setAge(int age) {
this.age = age;
} public String getAddress() {
return address;
} public void setAddress(String address) {
this.address = address;
} @Override
public String toString() {
return "UserBean [userName=" + userName + ", age=" + age + ", address="
+ address + "]";
}
//如果在这个实体bean中设置了这个带构造函数的构造方法则需要在这里加一个无参数的构造函数
public UserBean(){ }
public UserBean(String userName, int age, String address) {
super();
this.userName = userName;
this.age = age;
this.address = address;
}
}
<?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.xsd">
<bean id="userBean" class="cn.lonecloud.bean.step08iocfieldbyProperty.UserBean" >
<property name="userName" value="lonecloud"></property>
<property name="age" value="10"></property>
<property name="address" value="nanchang"></property>
</bean> </beans>

Spring 中出现Element : property Bean definitions can have zero or more properties. Property elements correspond to JavaBean setter methods exposed by the bean classes. Spring supports primitives, refer的更多相关文章

  1. Spring中Bean管理的常用注解

    在Spring中,主要用于管理bean的注解分为四大类:1.用于创建对象.2.用于给对象的属性注入值.3.用于改变作用的范围.4.用于定义生命周期.这几个在开发中经常接触到,也可以说每天都会遇见.其中 ...

  2. Spring点滴五:Spring中的后置处理器BeanPostProcessor讲解

    BeanPostProcessor接口作用: 如果我们想在Spring容器中完成bean实例化.配置以及其他初始化方法前后要添加一些自己逻辑处理.我们需要定义一个或多个BeanPostProcesso ...

  3. spring学习四:Spring中的后置处理器BeanPostProcessor

    BeanPostProcessor接口作用: 如果我们想在Spring容器中完成bean实例化.配置以及其他初始化方法前后要添加一些自己逻辑处理.我们需要定义一个或多个BeanPostProcesso ...

  4. Spring中单例模式中的饿汉和懒汉以及Spring中的多例模式

    链接:https://pan.baidu.com/s/1wgxnXnGbPdK1YaZvhO7PDQ 提取码:opjr 单例模式:每个bean定义只生成一个对象实例,每次getBean请求获得的都是此 ...

  5. (转)Spring中Singleton模式的线程安全

    不知道哪里的文章,总结性还是比较好的.但是代码凌乱,有的还没有图.如果找到原文了可以进行替换! spring中的单例 spring中管理的bean实例默认情况下是单例的[sigleton类型],就还有 ...

  6. Spring中重要的注解

    现在大部分的Spring项目都会用到注解.使用注解来替换xml,一行简单的注解就可以解决很多事情.但是你真的懂其中的原理吗. 本文翻译于 https://docs.spring.io/spring-f ...

  7. 面试必杀技,讲一讲Spring中的循环依赖

    本系列文章: 听说你还没学Spring就被源码编译劝退了?30+张图带你玩转Spring编译 读源码,我们可以从第一行读起 你知道Spring是怎么解析配置类的吗? 配置类为什么要添加@Configu ...

  8. [转] 9种设计模式在Spring中的运用

    作者:iCoding91地址:https://blog.csdn.net/caoxiaohong1005 转发的公众号地址,有其他设计模式介绍:https://mp.weixin.qq.com/s/Z ...

  9. 面试阿里,腾讯,字节跳动90%都会被问到的Spring中的循环依赖

    前言 Spring中的循环依赖一直是Spring中一个很重要的话题,一方面是因为源码中为了解决循环依赖做了很多处理,另外一方面是因为面试的时候,如果问到Spring中比较高阶的问题,那么循环依赖必定逃 ...

随机推荐

  1. yarn 淘宝源安装与使用用法

    Yarn 淘宝源 yarn config set registry https://registry.npm.taobao.org -g yarn config set sass_binary_sit ...

  2. requests关于Exceeded 30 redirects问题得出的结论

    昨天一个朋友在爬网页时出现的一个问题,以及后续我对这个问题进行了简单的测试. 先说出现的问题的简单描述. 首先是使用urllib请求网页: #urllib.request发起的请求 import ur ...

  3. JS的for循环小例子

    1.输出1-100的和 var sum = 0; for(var i=1;i<=100;i++){ sum = sum + i; } document.write(sum); 2.输出1-100 ...

  4. 自己模拟的一个简单的web服务器

    首先我为大家推荐一本书:How Tomcat Works.这本书讲的很详细的,虽然实际开发中我们并不会自己去写一个tomcat,但是对于了解Tomcat是如何工作的还是很有必要的. Servlet容器 ...

  5. kickstart无人值守

    笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 高逼格装系统的方法 Kickstar Cobbler 注意,kickstart并不是一个服务的名称,只是装系统的方 ...

  6. 2017-12-30-如何彻底清除现存GIT仓库的大量提交历史

    layout: post title: 2017-12-30-如何彻底清除现存GIT仓库的大量提交历史 key: 20171230 tags: GIT 版本管理 问答 modify_date: 201 ...

  7. .NET框架(转)

    三年前写的<.NET之美>的第六章,现在书名改为了<.NET专题解析>. 本书是一本讲解.NET技术的书籍,目标读者群也是在.NET框架(.NET Framework)下进行开 ...

  8. windows 7 wifi热点配置

    自我总结,有什么不足或更好的解决方案,请告知,感激不尽! 目的:闲来无事的童鞋,可以试一试自己配置wifi热点. ps:其实wifi热点配置是系统存在的功能,只不过需要配置. 现在win桌面wifi热 ...

  9. C#基础(三)--运算符及条件控制语句

    上一章我们了解了C#的一些数据基本类型.如何定义使用变量及类型之间的相互转换.可能大家会发现程序只能按照我们的要求从上向下这样顺序一条一条的执行. 那么程序能按照我们的要求,当某个条件成立的时候才执行 ...

  10. 在IAR下移植CC2650 contiki工程

    与Instant Contiki相比,在Windows的IAR下开发可以在线仿真,下载也更方便,因此我想把BLEach的工程移植到IAR下.弄了好几天总算编译并且下载成功了,参考了[这篇TI的wiki ...