Skip to content

Commit becea61

Browse files
committed
SPR-3360: util:property-path like functionality for the p-namespace
1 parent 1b6c492 commit becea61

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2002-2009 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.beans.factory.xml;
18+
19+
import static org.junit.Assert.assertEquals;
20+
import org.junit.Test;
21+
import test.beans.ITestBean;
22+
23+
import org.springframework.context.ApplicationContext;
24+
import org.springframework.context.support.ClassPathXmlApplicationContext;
25+
26+
/**
27+
* Tests for combining the expression language and the p namespace. This test
28+
*
29+
* @author Arjen Poutsma
30+
*/
31+
public class SimplePropertyNamespaceHandlerWithExpressionLanguageTests {
32+
33+
@Test
34+
public void combineWithExpressionLanguage() {
35+
ApplicationContext applicationContext =
36+
new ClassPathXmlApplicationContext("simplePropertyNamespaceHandlerWithExpressionLanguageTests.xml",
37+
getClass());
38+
ITestBean foo = applicationContext.getBean("foo", ITestBean.class);
39+
ITestBean bar = applicationContext.getBean("bar", ITestBean.class);
40+
assertEquals("Invalid name", "Baz", foo.getName());
41+
assertEquals("Invalid name", "Baz", bar.getName());
42+
}
43+
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:p="http://www.springframework.org/schema/p"
5+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
6+
7+
<bean id="foo" class="test.beans.TestBean" p:name="Baz"/>
8+
9+
<bean id="bar" class="test.beans.TestBean" p:name="#{foo.name}"/>
10+
11+
</beans>

0 commit comments

Comments
 (0)