Spring(Bean)5
spel
<bean id="address" class="com.atguigu.spring.beans.spel.Address">
<!-- 使用spel为属性赋值 -->
<property name="city" value="#{'BeiJing'}"></property>
<property name="street" value="HuiLongGuan"></property>
</bean>
<!-- Car -->
<bean id="car" class="com.atguigu.spring.beans.spel.Car">
<property name="brand" value="bmw"></property>
<property name="price" value="#{400000}"></property>
<!-- 使用spel调用类的静态属性 方法 -->
<property name="tyrePerimeter" value="#{T(java.lang.Math).PI * 100 * 2 }"></property>
</bean>
<!-- Person -->
<bean id="person" class="com.atguigu.spring.beans.spel.Person">
<property name="name" value="Tom"></property>
<!-- 使用spel引用其他bean的属性 -->
<property name="city" value="#{address.city}"></property>
<!-- 使用spel引用其他的bean -->
<property name="car" value="#{car}"></property>
<!-- 使用spel支持的运算符 -->
<property name="info" value="#{car.price >300000 ? '码神':'码农'}"></property>
</bean>
Spring(Bean)5的更多相关文章
- Spring(Bean)1
Spring支持3种依赖注入的方式 (DI依赖注入)*属性注入 (配置bean set方法注入) <bean id="car" class="spring.bean ...
- Spring(Bean)6
生命周期构造 --->set--->Bean init前后执行 (新创建 类) public class MyBeanPostProcesser implements BeanPostPr ...
- Spring(Bean)3
bean的继承<!-- bean 的继承 作为模板来使用. 可以通过abstract="true"来指定把该bean配置为·抽象的. 通过abstract="tru ...
- Spring(Bean)2
<!-- util:list封装的心 --> <bean id="personList2" class="spring.beans.di.collect ...
- Spring(Bean)4 配置数据源、连接池
<!-- 配置数据源 Mysql c3p0: 连接池. <bean id="dataSource" class="com.mchange.v2.c3p0.Co ...
- Spring(一)之IOC、bean、注入
[TOC] spring简介 首先它是一个开源的.用来简化企业级应用开发的框架. Spring为编写企业应用程序提供了轻量的解决方案,同时仍然支持使用声明式事务. 用RMI或web service远程 ...
- (转)java之Spring(IOC)注解装配Bean详解
java之Spring(IOC)注解装配Bean详解 在这里我们要详细说明一下利用Annotation-注解来装配Bean. 因为如果你学会了注解,你就再也不愿意去手动配置xml文件了,下面就看看 ...
- Spring(八):Spring配置Bean(一)BeanFactory&ApplicationContext概述、依赖注入的方式、注入属性值细节
在Spring的IOC容器里配置Bean 配置Bean形式:基于xml文件方式.基于注解的方式 在xml文件中通过bean节点配置bean: <?xml version="1.0&qu ...
- 【初识Spring】对象(Bean)实例化及属性注入(xml方式)
title: [初识Spring]对象(Bean)实例化及属性注入(xml方式) date: 2018-08-29 17:35:15 tags: [Java,Web,Spring] --- #初识S ...
随机推荐
- 致Java星球程序员兄弟们的一封信
致Java星球程序员兄弟们的一封信 亲爱的Java星球的程序员兄弟们: 你们好!我是来自地球的一名Java程序员,首先我代表地球人对贵星球的高司令来到地球传授Java语言,造福了全人类,造福了整个地球 ...
- SVN 下载与安装(超简单)!!!
一 SVN 是什么? 在公司做过团队开发都知道,一个项目的代码要保持最新的版本. 举个例子! 例如:一个公司的项目有5人开发(A,B,C,D,E五个人),有一个地方专门存放项目的最新的代码,这个地 ...
- post方式实现导出/下载文件
项目需求: 前端需要传入过多的参数给后端,get地址栏不行,只能接受post方式去导出数据 1.get的下载方式 通常下载方式如下: let url = xxxx.action?a=xx&b= ...
- 学习笔记02form
1.<form>为表单标签*如果要把数据提交到服务器,则需要将<input> <textarea> <select>等表单元素放到<from> ...
- [考试反思]0926csp-s模拟测试52:审判
也好. 该来的迟早会来. 反思再说吧. 向下跳过直到另一条分界线 %%%cbx也拿到了他的第一个AK了呢. 我的还是遥不可及. 我恨你,DeepinC. 我恨透你了.你亲手埋葬所有希望,令我无比气愤. ...
- Spring容器自动调用方法的两种方式
先看一个Spring中Bean的实例化过程: 1.配置文件中指定Bean的init-method参数 <bean class="com.jts.service.UserService& ...
- 『题解』LibreOJ6277 数列分块入门 1
更好的阅读体验 Portal Portal1: LibreOJ Description 给出一个长为\(n\)的数列,以及\(n\)个操作,操作涉及区间加法,单点查值. Input 第一行输入一个数字 ...
- 『题解』UVa11324 The Largest Clique
原文地址 Problem Portal Portal1:UVa Portal2:Luogu Portal3:Vjudge Description Given a directed graph \(\t ...
- hashMapp
原文链接:https://www.iteye.com/topic/539465 Hashmap是一种非常常用的.应用广泛的数据类型,最近研究到相关的内容,就正好复习一下.网上关于hashmap的文章很 ...
- oracle直接调用web services
oracle调用C#开发web services 1, 去oracle官网上下载dbws-callout-utility-10131.zip 地址:https://oracle-base.com/a ...