Skip to content

Commit

Permalink
Make configuration beans identifiable
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienlauer committed Feb 26, 2017
1 parent aea14f6 commit eef0c89
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Version 3.1.0 (2017-02-26)

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

# Version 3.0.1 (2017-01-13)

Expand Down
9 changes: 9 additions & 0 deletions core/src/it/java/org/seedstack/spring/SpringProviderIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public class SpringProviderIT {
@Named("springRepository")
SpringRepository springRepository;

@Inject
@Named("configBean")
String configValue;

@Test
public void can_get_spring_bean_by_interface_type() {
Assertions.assertThat(service).isNotNull();
Expand All @@ -39,4 +43,9 @@ public void scanned_components_are_detected() {
Assertions.assertThat(springRepository).isNotNull();
Assertions.assertThat(springRepository.getId()).isEqualTo(1L);
}

@Test
public void bean_can_be_identified() throws Exception {
Assertions.assertThat(configValue).isEqualTo("titi");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
xmlns:seed="http://www.seedstack.org/xml-schemas/spring-support"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.seedstack.org/xml-schemas/spring-support http://www.seedstack.org/xml-schemas/spring-support/spring-support-1.2.xsd">

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

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

16 changes: 12 additions & 4 deletions core/src/main/resources/META-INF/schemas/spring-support-1.2.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,23 @@

<xsd:element name="configuration">
<xsd:complexType>
<xsd:attribute name="key" type="xsd:string" use="required"/>
<xsd:attribute name="default" type="xsd:string" use="optional"/>
<xsd:attribute name="mandatory" type="xsd:boolean" use="optional" default="true"/>
<xsd:complexContent>
<xsd:extension base="beans:identifiedType">
<xsd:attribute name="key" type="xsd:string" use="required"/>
<xsd:attribute name="default" type="xsd:string" use="optional"/>
<xsd:attribute name="mandatory" type="xsd:boolean" use="optional" default="true"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>

<xsd:element name="datasource">
<xsd:complexType>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:complexContent>
<xsd:extension base="beans:identifiedType">
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

<properties>
<seed.version>3.1.0</seed.version>
<business.version>3.0.1</business.version>
<jdbc.version>3.0.0</jdbc.version>
<jpa-addon.version>3.0.0</jpa-addon.version>
<business.version>3.0.2-SNAPSHOT</business.version>
<jdbc.version>3.0.1-SNAPSHOT</jdbc.version>
<jpa-addon.version>3.0.1-SNAPSHOT</jpa-addon.version>
<spring.version>4.3.6.RELEASE</spring.version>
<spring-batch.version>3.0.7.RELEASE</spring-batch.version>

Expand Down

0 comments on commit eef0c89

Please sign in to comment.