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
在这个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的更多相关文章
- Spring中Bean管理的常用注解
在Spring中,主要用于管理bean的注解分为四大类:1.用于创建对象.2.用于给对象的属性注入值.3.用于改变作用的范围.4.用于定义生命周期.这几个在开发中经常接触到,也可以说每天都会遇见.其中 ...
- Spring点滴五:Spring中的后置处理器BeanPostProcessor讲解
BeanPostProcessor接口作用: 如果我们想在Spring容器中完成bean实例化.配置以及其他初始化方法前后要添加一些自己逻辑处理.我们需要定义一个或多个BeanPostProcesso ...
- spring学习四:Spring中的后置处理器BeanPostProcessor
BeanPostProcessor接口作用: 如果我们想在Spring容器中完成bean实例化.配置以及其他初始化方法前后要添加一些自己逻辑处理.我们需要定义一个或多个BeanPostProcesso ...
- Spring中单例模式中的饿汉和懒汉以及Spring中的多例模式
链接:https://pan.baidu.com/s/1wgxnXnGbPdK1YaZvhO7PDQ 提取码:opjr 单例模式:每个bean定义只生成一个对象实例,每次getBean请求获得的都是此 ...
- (转)Spring中Singleton模式的线程安全
不知道哪里的文章,总结性还是比较好的.但是代码凌乱,有的还没有图.如果找到原文了可以进行替换! spring中的单例 spring中管理的bean实例默认情况下是单例的[sigleton类型],就还有 ...
- Spring中重要的注解
现在大部分的Spring项目都会用到注解.使用注解来替换xml,一行简单的注解就可以解决很多事情.但是你真的懂其中的原理吗. 本文翻译于 https://docs.spring.io/spring-f ...
- 面试必杀技,讲一讲Spring中的循环依赖
本系列文章: 听说你还没学Spring就被源码编译劝退了?30+张图带你玩转Spring编译 读源码,我们可以从第一行读起 你知道Spring是怎么解析配置类的吗? 配置类为什么要添加@Configu ...
- [转] 9种设计模式在Spring中的运用
作者:iCoding91地址:https://blog.csdn.net/caoxiaohong1005 转发的公众号地址,有其他设计模式介绍:https://mp.weixin.qq.com/s/Z ...
- 面试阿里,腾讯,字节跳动90%都会被问到的Spring中的循环依赖
前言 Spring中的循环依赖一直是Spring中一个很重要的话题,一方面是因为源码中为了解决循环依赖做了很多处理,另外一方面是因为面试的时候,如果问到Spring中比较高阶的问题,那么循环依赖必定逃 ...
随机推荐
- Python3基础知识之元组、集合、字典
1.元组 元组特点元组是不可变的两个元组可以做加法,不能做减法 元组的方法 >>> S('a', 'b', 'c', 'd', 'e')>>> S=('a','b' ...
- 以守护进程的方式部署flask
1.文件目录 创建一个简单的flask 项目... application = Flask(__name__) application.debug = True 2.安装wsgi pip instal ...
- linux libpcap的性能问题,请大家注意绕行。
内核代码中,ip_rcv是ip层收包的主入口函数,该函数由软中断调用.存放数据包的sk_buff结构包含有目的地ip和端口信息,此时ip层进行检查,如果目的地ip不是本机,且没有开启转发的话,则将包丢 ...
- linu_nginx_location语法
location的作用是什么? 每个server中都需要配置location,通过location匹配域名后内容,再通过location响应同一个域名下不同请求 location语法 location ...
- 数据仓库搭建——Inmon与Kimball
一.简介 1.1 历史 搞数据仓库这么久,实践中发现首先搭建数据集市,还是清洗数据之后,直接进入数据立方体(形成维度表和实施表)形成核心数据仓库层,是个选择题... 随后发现这其实涉及到了数据仓库的历 ...
- MVC登出友情提示
好奇心害死猫,话说12月30号,阳历17年末,行至小镇农户,有羊在鸣,由于好奇心泛滥,循声而至,发现一只被拴住的羊,好心喂草,不料反被舔了一口,得亏抽手及时,不然小拇指估计被咬掉,没错,是咬掉,即使如 ...
- 网卡bond技术
概览: 目前网卡绑定mode共有七种(0~6)bond0.bond1.bond2.bond3.bond4.bond5.bond6 常用的有三种: mode=0:平衡负载模式,有自动备援,但需要&quo ...
- 第一个jdbc
1. jdbc就是java提供连接数据库的规范.在java中就是一套接口.实现这套接口的这套类就是数据库驱动,用数据库驱动才能连接数据库. 2. Junit是为了方便测试的技术手段,在测试时,一个类中 ...
- 16_Python闭包
一.什么是闭包 什么是闭包:内函数对外函数非全局变量的引用,并且外函数的返回值是内函数的引用(地址). def wrapper(): name = 'zhangsan' def inner(): na ...
- Django跨域请求之JSONP和CORS
现在来新建一个Django项目server01,url配置为 url(r'^getData.html$',views.get_data) 其对应的视图函数为get_data: from django. ...