Skip to content

Commit eef0c89

Browse files
committed
Make configuration beans identifiable
1 parent aea14f6 commit eef0c89

File tree

5 files changed

+30
-8
lines changed

5 files changed

+30
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Version 3.1.0 (2017-02-26)
22

33
* [new] Add the ability to retrieve a SeedStack JDBC data source with the `seed:datasource` XML element.
4+
* [chg] `seed:configuration` bean is now identifiable allowing to reuse configuration values in contexts.
5+
* [fix] Fix transitive dependency to poms SNAPSHOT.
46

57
# Version 3.0.1 (2017-01-13)
68

core/src/it/java/org/seedstack/spring/SpringProviderIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public class SpringProviderIT {
2828
@Named("springRepository")
2929
SpringRepository springRepository;
3030

31+
@Inject
32+
@Named("configBean")
33+
String configValue;
34+
3135
@Test
3236
public void can_get_spring_bean_by_interface_type() {
3337
Assertions.assertThat(service).isNotNull();
@@ -39,4 +43,9 @@ public void scanned_components_are_detected() {
3943
Assertions.assertThat(springRepository).isNotNull();
4044
Assertions.assertThat(springRepository.getId()).isEqualTo(1L);
4145
}
46+
47+
@Test
48+
public void bean_can_be_identified() throws Exception {
49+
Assertions.assertThat(configValue).isEqualTo("titi");
50+
}
4251
}

core/src/it/resources/META-INF/spring/SpringProviderIT-context.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
-->
1111
<beans xmlns="http://www.springframework.org/schema/beans"
1212
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
13-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
13+
xmlns:seed="http://www.seedstack.org/xml-schemas/spring-support"
14+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
15+
http://www.seedstack.org/xml-schemas/spring-support http://www.seedstack.org/xml-schemas/spring-support/spring-support-1.2.xsd">
1416

1517
<bean id="service" class="org.seedstack.spring.fixtures.DummyService">
1618
<property name="from" value="spring"/>
1719
</bean>
1820

21+
<seed:configuration id="configBean" key="some.key" default="titi"/>
1922
</beans>
2023

core/src/main/resources/META-INF/schemas/spring-support-1.2.xsd

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,23 @@
3131

3232
<xsd:element name="configuration">
3333
<xsd:complexType>
34-
<xsd:attribute name="key" type="xsd:string" use="required"/>
35-
<xsd:attribute name="default" type="xsd:string" use="optional"/>
36-
<xsd:attribute name="mandatory" type="xsd:boolean" use="optional" default="true"/>
34+
<xsd:complexContent>
35+
<xsd:extension base="beans:identifiedType">
36+
<xsd:attribute name="key" type="xsd:string" use="required"/>
37+
<xsd:attribute name="default" type="xsd:string" use="optional"/>
38+
<xsd:attribute name="mandatory" type="xsd:boolean" use="optional" default="true"/>
39+
</xsd:extension>
40+
</xsd:complexContent>
3741
</xsd:complexType>
3842
</xsd:element>
3943

4044
<xsd:element name="datasource">
4145
<xsd:complexType>
42-
<xsd:attribute name="name" type="xsd:string" use="required"/>
46+
<xsd:complexContent>
47+
<xsd:extension base="beans:identifiedType">
48+
<xsd:attribute name="name" type="xsd:string" use="required"/>
49+
</xsd:extension>
50+
</xsd:complexContent>
4351
</xsd:complexType>
4452
</xsd:element>
4553

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
<properties>
2626
<seed.version>3.1.0</seed.version>
27-
<business.version>3.0.1</business.version>
28-
<jdbc.version>3.0.0</jdbc.version>
29-
<jpa-addon.version>3.0.0</jpa-addon.version>
27+
<business.version>3.0.2-SNAPSHOT</business.version>
28+
<jdbc.version>3.0.1-SNAPSHOT</jdbc.version>
29+
<jpa-addon.version>3.0.1-SNAPSHOT</jpa-addon.version>
3030
<spring.version>4.3.6.RELEASE</spring.version>
3131
<spring-batch.version>3.0.7.RELEASE</spring-batch.version>
3232

0 commit comments

Comments
 (0)