在这个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. 史上最全的判断android,ios还是ipad访问,附上多种语言的实现方式

    js判断: (function(a,b){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elain ...

  2. 关于eclipse 与OpenCV 配置频繁报错的问题总结Program "C:/SDK/android-ndk-xxx/ndk-build.cmd" is not found in PATH报错的解决!

    2018-01-3116:58:12 Program "C:/SDK/android-ndk-r8/ndk-build.cmd" is not found in PATH 今天这一 ...

  3. linkin大话java

    青春不灭,理想犹存,linkin--勿忘初心! 不知不觉已经和java并肩作战将近了2年,在这2年之中模模糊糊研究了java2ee领域的好多东西,但是都没有做系统的整理.以前写的笔记也是零零散散不成一 ...

  4. 使用TransactionScope做分布式事务协调

    //场景是使用在多个数据库之间的协调,.NET 2.0使用一个新的类型 TransactionScope来进行协调,这与之前的COM+协调是相对来说更加方便的 //需要引用一个新的程序集:System ...

  5. apache编译安装参数说明

    apache编译安装参数说明 ./configure //配置源代码树--prefix=/usr/local/apache2 //体系无关文件的顶级安装目录prefix ,也就apache的安装目录. ...

  6. Jmeter_24个常用函数(分享帖)

    JMeter提供了很多函数,如果能够熟练使用,可以为脚本带来很多方便. JMeter函数是一种特殊值,可用于除测试计划外的任何组件. 函数调用的格式如下所示:${__functionName(var1 ...

  7. pwd 的“P”选项

    1.目录是链接目录时,pwd -P  显示出实际路径,而非使用连接(link)路径:pwd显示的是连接路径 例: [root@localhost soft]# cd /etc/init.d [root ...

  8. dump、libeay32.dll、gsoap、webserver多线程调用gsoap产生崩溃

    问题:调用webserver接口出现dump文件,dump文件指向libeay32.dll有问题,产生崩溃的原因是gsoap多线程问题,多线程调用时需要程序启动的地方调用如下函数进行多线程初始化: i ...

  9. Git:warning: LF will be replaced by CRLF

    windows中的换行符为 CRLF, 而在linux下的换行符为LF,所以在执行add . 时出现提示,解决办法: $ rm -rf .git // 删除.git $ git config --gl ...

  10. spring jdbc踩坑日记,new JdbcTemplate 为null导致UserDao一直为null

    private DataSource datasource; private JdbcTemplate jdbcTemplateObject; //设置注入 public void setdataso ...