Java笔记

知识点总结


Spel注入

<h1>Spring的属性注入-spel注入</h1> <pre><code>1.Spel:spring expression language ,spring 表达式语言 对于依赖注入进行简化 2.语法:#{表达式} 3.&lt;bean id="" value="#{表达式}"&gt; Spel 表达式语言 语法:#{} #{'hello'} #{beanID} 使用字符串 #{beanId.content.toUpperCase()}:使用制定名属性并使用方法 #{T(java.lang.Math).PI}:使用静态字段或方法</code></pre> <pre><code class="language-java"> &lt;bean id="Person" class="net.spring.ioc.methodConstruct.setterPerson" &gt; &lt;property name="name" value="spicy"/&gt; &lt;property name="age" value="1" /&gt; &lt;/bean&gt; &lt;bean id="price" class="net.spring.ioc.methodConstruct.GoodsNumber" /&gt; &lt;bean id="con" class="net.spring.ioc.methodConstruct.Person"&gt; &lt;!----&gt; &lt;property name="name" value="#{'spicygoods'}" /&gt; &lt;property name="age" value="#{price.price()}" /&gt; &lt;property name="Person" value="#{Person}" /&gt; &lt;/bean&gt; 輸入: Person {name='spicygoods', age=0, person=setterPerson{name='spicy', age=1}}</code></pre>

页面列表

ITEM_HTML