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

免费建立网站有必要吗营销软文

免费建立网站有必要吗,营销软文,微信小程序开通流程,做网站需要注册商标多少类SpringEL bean引用实例 文章目录 SpringEL bean引用实例介绍Spring EL以注解的形式Spring EL以XML的形式 介绍 在Spring EL,可以使用点(.)符号嵌套属性参考一个bean。例如,“bean.property_name” public class Customer {Value("#{addressBean.c…

SpringEL bean引用实例

文章目录

  • SpringEL bean引用实例
    • 介绍
    • Spring EL以注解的形式
    • Spring EL以XML的形式

介绍

在Spring EL,可以使用点(.)符号嵌套属性参考一个bean。例如,“bean.property_name”

public class Customer {@Value("#{addressBean.country}")private String country;
}

在上面的代码片段,它从"addressBean""bean注入了"country"属性到现在的"customer"类的"country"属性的值

Spring EL以注解的形式

使用 SpEL 引用一个bean,bean属性也它的方法

package com.yiibai.core;import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;@Component("customerBean")
public class Customer {@Value("#{addressBean}")private Address address;@Value("#{addressBean.country}")private String country;@Value("#{addressBean.getFullAddress('yiibai')}")private String fullAddress;//getter and setter methods@Overridepublic String toString() {return "Customer [address=" + address + "\n, country=" + country+ "\n, fullAddress=" + fullAddress + "]";}}
package com.yiibai.core;import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;@Component("addressBean")
public class Address {@Value("GaoDeng, QiongShang")private String street;@Value("571100")private int postcode;@Value("CN")private String country;public String getFullAddress(String prefix) {return prefix + " : " + street + " " + postcode + " " + country;}//getter and setter methodspublic void setCountry(String country) {this.country = country;}@Overridepublic String toString() {return "Address [street=" + street + ", postcode=" + postcode+ ", country=" + country + "]";}}

执行结果

Customer obj = (Customer) context.getBean("customerBean");
System.out.println(obj);

输出结果

Customer [address=Address [street=GaoDeng, QiongShang, postcode=571100, country=CN]
, country=CN
, fullAddress=yiibai : GaoDeng, QiongShang 571100 CN]

Spring EL以XML的形式

<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-3.0.xsd"><bean id="customerBean" class="com.yiibai.core.Customer"><property name="address" value="#{addressBean}" /><property name="country" value="#{addressBean.country}" /><property name="fullAddress" value="#{addressBean.getFullAddress('yiibai')}" /></bean><bean id="addressBean" class="com.yiibai.core.Address"><property name="street" value="GaoDeng, QiongShang" /><property name="postcode" value="571100" /><property name="country" value="CN" /></bean></beans>
http://www.jinmujx.cn/news/117813.html

相关文章:

  • 临漳网站建设互联网运营自学课程
  • 用bootstarp做的网站长沙百度关键词排名
  • 做视频网站视频存放问题营销的手段和方法
  • 域名备案用的网站建设方案沈阳seo排名收费
  • 如何做菠菜网站代理个人怎么注册自己的网站
  • 瑜伽网站设计模板建站教程
  • 美橙互联同类型网站网站平台推广
  • 营销网站的设计与实现杭州网站优化流程
  • 青岛网站设计哪家公司网推接单平台
  • 网站制作需要学习什么seo关键词优化提高网站排名
  • 有专业做网站的吗gre考全网营销代理加盟
  • 滕州网站制作seo三人行论坛
  • 包头seo推广哪家专业湛江seo推广外包
  • 网站后台 验证码错误南京seo按天计费
  • 使用网站效果深圳百度国际大厦
  • 网站初期 权重怎么做百度网首页官网登录
  • 织梦如何做二级网站泰安做网站公司
  • 新疆建设职业培训中心网站郑州百度网站优化排名
  • 申请网页要多少钱seo经典案例
  • 国外做mg动画的网站大全app推广渠道商
  • 微网站如何做网站优化怎么操作
  • 南京网站建设优化关键词seo价格
  • 上海微信小程序网站建设分类达人的作用
  • wordpress首页导航关键词seo优化软件
  • 分类网站上怎么做锚文本惠州网站排名提升
  • 青海网站建设费用价格网络营销广告策划
  • 如何做监控网站如何在百度上做免费推广
  • 珠海网站关键词排名服务商小程序怎么开发自己的小程序
  • 国内最炫酷的网站金戈枸橼酸西地那非片
  • 山东网站建设公司企业文化案例