当前位置: 首页 > news >正文

火车头自动发布wordpress标签福州seo优化排名推广

火车头自动发布wordpress标签,福州seo优化排名推广,江西正东建设工程有限公司网站,wordpress主题首页怎么修改在Spring中,可以使用依赖检查功能,以确保所要求的属性可设置或者注入。依赖检查模式4个依赖检查支持的模式:none – 没有依赖检查,这是默认的模式。simple – 如果基本类型(int, long,double…)和集合类型(map, list..)的任何属性…
在Spring中,可以使用依赖检查功能,以确保所要求的属性可设置或者注入。
依赖检查模式
4个依赖检查支持的模式:
  • none – 没有依赖检查,这是默认的模式。
  • simple – 如果基本类型(int, long,double…)和集合类型(map, list..)的任何属性都没有设置,UnsatisfiedDependencyException将被抛出。
  • objects – 如果对象类型的任何属性都没有设置,UnsatisfiedDependencyException将被抛出。
  • all – 如果任何类型的任何属性都没有被设置,UnsatisfiedDependencyException将被抛出。

注:默认模式是 none

示例

Customer和Person对象的示例。
package com.yiibai.common;public class Customer 
{private Person person;private int type;private String action;//getter and setter methods
}
package com.yiibai.common;public class Person 
{private String name;private String address;private int age;//getter and setter methods	
}

1. none 依赖检查

Spring bean配置文件使用 “none” 依赖检查模式。
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><bean id="CustomerBean" class="com.yiibai.common.Customer" ><property name="action" value="buy" /></bean><bean id="PersonBean" class="com.yiibai.common.Person"><property name="name" value="yiibai" /><property name="address" value="address ABC" /><property name="age" value="29" /></bean></beans>
如果没有明确定义的依赖检查模式,其默认为“none”。没有依赖检查将执行。

2. simple 依赖检查

Spring bean的配置文件使用“simple”依赖检查模式。
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><bean id="CustomerBean" class="com.yiibai.common.Customer" dependency-check="simple"><property name="person" ref="PersonBean" /><property name="action" value="buy" /></bean><bean id="PersonBean" class="com.yiibai.common.Person"><property name="name" value="yiibai" /><property name="address" value="address ABC" /><property name="age" value="29" /></bean></beans>
在“type”属性(基本类型或集合类型),如尚未设置,UnsatisfiedDependencyException将抛出。
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'CustomerBean' 
defined in class path resource [config/Spring-Customer.xml]: 
Unsatisfied dependency expressed through bean property 'type': 
Set this property value or disable dependency checking for this bean.

3. objects 依赖检查

Spring bean配置文件的 “objects”依赖检查模式。
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><bean id="CustomerBean" class="com.yiibai.common.Customer" dependency-check="objects"><property name="action" value="buy" /><property name="type" value="1" /></bean><bean id="PersonBean" class="com.yiibai.common.Person"><property name="name" value="yiibai" /><property name="address" value="address ABC" /><property name="age" value="29" /></bean></beans>
在'person'属性(对象类型),尚未设置,一个UnsatisfiedDependencyException将抛出。
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'CustomerBean' 
defined in class path resource [config/Spring-Customer.xml]: 
Unsatisfied dependency expressed through bean property 'person': 
Set this property value or disable dependency checking for this bean.

4. all 依赖检查

Spring bean配置文件的“all”依赖检查模式。
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><bean id="CustomerBean" class="com.yiibai.common.Customer" dependency-check="all"><property name="action" value="buy" /></bean><bean id="PersonBean" class="com.yiibai.common.Person"><property name="name" value="yiibai" /><property name="address" value="address ABC" /><property name="age" value="29" /></bean></beans>
对“simple”和“objects”模式的组合,如果有的话类型(原型,集合和对象)的任何属性都没有设置,一个UnsatisfiedDependencyException将被抛出。
全局默认的依赖检查
明确定义的依赖检查模式,每个Bean配置繁琐且容易出错,可以在<beans>根元素设置一个默认的依赖性检查属性强制<beans>根元素内声明的整个bean类适用此规则。然而,这根默认模式将通过一个bean自己指定的模式下可覆盖。
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd" default-dependency-check="all"><bean id="CustomerBean" class="com.yiibai.common.Customer"><property name="action" value="buy" /><property name="type" value="1" /></bean><bean id="PersonBean" class="com.yiibai.common.Person"><property name="name" value="yiibai" /><property name="address" value="address ABC" /><property name="age" value="29" /></bean></beans>
在这个配置文件中声明所有的Bean类默都是“all”依赖检查模式。
@Required 注解
在大多数情况下,你只需要确保特定属性已经设置,但有一定是所有的类型(原始,集合或对象)属性。
http://www.lbrq.cn/news/2411101.html

相关文章:

  • 制作微信网站模板seo排名工具
  • 怎么做返利网站广州网络运营课程培训班
  • 网站开发和嵌入式开发今日疫情最新数据
  • 5免费网站建站关键词智能调词工具
  • 网站建设需求文档模板下载一键生成网页
  • 如何自己搭建一个个人网站百度客服
  • 中国江西网官方网站百度站长中心
  • 经典网站设计案例营销公司网站
  • 龙川网站建设怎样申请网站
  • wordpress文章专题插件平台seo什么意思
  • 网站目录层级建设网站优化的方法
  • asp网站文章自动更新杭州网站
  • 政务性网站建设费用百度开发者平台
  • 沈阳单页网站制作软文投放平台有哪些?
  • 会员制网站建设百度搜索推广怎么做
  • 整站优化网站报价怎么投放网络广告
  • 笔记本做网站seo关键词排名优化技巧
  • 1688网站靠谱吗个人网页制作成品
  • 百度获取入口宁波 seo排名公司
  • 做资源下载网站条件商品关键词优化的方法
  • 成都建工网站谷歌搜索引擎营销
  • 做cpc不做网站可以吗全网营销代理加盟
  • 百度推广如何代理加盟武汉seo广告推广
  • 做快递单的网站会不会是骗人的直通车优化推广
  • 免费企业网站源码生成浏览器网页版入口
  • 延平区城乡建设和旅游局网站seo技术自学
  • 做网站成功网站seo标题是什么意思
  • 怎样制作免费的网站网络运营商
  • 企业网站建设与网页设计运营网站是什么意思
  • 有什么网站做知识吗郑州关键词优化费用
  • LP-MSPM0G3507学习--07定时器之二定时节拍
  • 【无标题】重点阅读——如何在信息层面区分和表征卷曲维度,解析黑洞内部的维度区分机制
  • MySQL练习3
  • Spring全面讲解(无比详细)
  • 怎么把图片做成实拍的感觉?给图片加上拍摄时间,相机信息等就可以了
  • .NET Core EFCore零基础快速入门简单使用