Constretto :: Spring Integration - 3.0.0-BETA1

Spring extensions for the Constretto configuration toolkit

License

License

ASF v2 License
GroupId

GroupId

org.constretto
ArtifactId

ArtifactId

constretto-spring
Last Version

Last Version

3.0.0-BETA1
Release Date

Release Date

Type

Type

jar
Description

Description

Constretto :: Spring Integration - 3.0.0-BETA1
Spring extensions for the Constretto configuration toolkit
Project URL

Project URL

http://constretto.org/constretto-spring/

Download constretto-spring

How to add to project

<!-- https://jarcasting.com/artifacts/org.constretto/constretto-spring/ -->
<dependency>
    <groupId>org.constretto</groupId>
    <artifactId>constretto-spring</artifactId>
    <version>3.0.0-BETA1</version>
</dependency>
// https://jarcasting.com/artifacts/org.constretto/constretto-spring/
implementation 'org.constretto:constretto-spring:3.0.0-BETA1'
// https://jarcasting.com/artifacts/org.constretto/constretto-spring/
implementation ("org.constretto:constretto-spring:3.0.0-BETA1")
'org.constretto:constretto-spring:jar:3.0.0-BETA1'
<dependency org="org.constretto" name="constretto-spring" rev="3.0.0-BETA1">
  <artifact name="constretto-spring" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.constretto', module='constretto-spring', version='3.0.0-BETA1')
)
libraryDependencies += "org.constretto" % "constretto-spring" % "3.0.0-BETA1"
[org.constretto/constretto-spring "3.0.0-BETA1"]

Dependencies

compile (9)

Group / Artifact Type Version
org.constretto : constretto-api jar 3.0.0-BETA1
org.constretto : constretto-core jar 3.0.0-BETA1
org.slf4j : slf4j-api jar 1.7.12
org.slf4j : jcl-over-slf4j jar 1.7.12
org.springframework : spring-core jar 4.1.7.RELEASE
org.springframework : spring-beans jar 4.1.7.RELEASE
org.springframework : spring-context jar 4.1.7.RELEASE
org.springframework : spring-aop jar 4.1.7.RELEASE
javax.annotation : jsr250-api jar 1.0

test (8)

Group / Artifact Type Version
org.slf4j : slf4j-simple jar 1.7.12
junit : junit jar 4.12
org.aspectj : aspectjweaver jar 1.8.5
org.springframework : spring-test jar 4.1.7.RELEASE
org.ini4j : ini4j jar 0.5.2
org.jasypt : jasypt jar 1.9.1
commons-beanutils : commons-beanutils jar 1.9.2
com.github.stefanbirkner : system-rules jar 1.9.0

Project Modules

There are no modules declared in this project.

Constretto Spring Module

Support for using Constretto in Spring contexts. It includes namespace support for XML-based Spring contexts as well as a PropertyPlaceHolder implementation (allowing property placeholders refering to to Constretto configuration keys to be used in bean definitions).

** Note: This module used to be part of constretto-core but will starting with version 3 be maintained and versioned independently of constretto-core **

Build Status Coverage Status

Compatibility

The Spring module is tested with Spring 3.2.X and Java 7. Most features will probably work fine with Spring 4.X and/or Java 8, but 100% compatibility can not be guaranteed.

Adding dependency

Maven

   <dependency>
     <groupId>org.constretto</groupId>
     <artifactId>constretto-spring</artifactId>
     <version>3.0.0-BETA1</version>
   </dependency>

Spring XML Namespace support

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:constretto="http://constretto.org/schema/constretto"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://constretto.org/schema/constretto http://constretto.org/schema/constretto/constretto-1.2.xsd">

    <constretto:configuration annotation-config="true" property-placeholder="true">
        <constretto:stores>
            <constretto:properties-store>
                <constretto:resource location="classpath:properties/test1.properties"/>
            </constretto:properties-store>
        </constretto:stores>
    </constretto:configuration>
    
    <bean class="org.constretto.beans.ExampleBean">
        <property name="field" value="${constretto.key}" />
    </bean>
</beans>

Spring JavaConfig support

There are two ways to enable Constretto support for Java-based Spring contexts. The first method is to add the @EnableConstretto annotation and a static method returning a ConstrettoConfiguration configuration

using @EnableConstretto

    @EnableConstretto
    @org.springframework.context.annotation.Configuration
    public class TestContext  {
    
        @Configuration(required = true) // Will be injected by Constretto's Configuration processor
        private String key1;
    
        @Value("${key1}") // Will be injected by Constretto's Property placeholder processor
        private String key1AsValue;
    
        // a static method returning a ConstrettoConfiguration must be defined
        public static org.constretto.ConstrettoConfiguration constrettoConfiguration() {
            return new ConstrettoBuilder()
                    .createPropertiesStore()
                    .addResource(Resource.create("classpath:properties/test1.properties"))
                    .done()
                    .getConfiguration();
        }
    }

Extending BasicConstrettoConfiguration

The second method is to extend the BasicConstrettoConfiguration class and override the constrettoConfiguration() method

    @org.springframework.context.annotation.Configuration
    public class TestContext extends BasicConstrettoConfiguration {
    
        @Configuration(required = true) // Will be injected by Constretto's Configuration processor
        private String key1;
    
        @Value("${key1}") // Will be injected by Constretto's Property placeholder processor
        private String key1AsValue;
    
        @Override
        public org.constretto.ConstrettoConfiguration constrettoConfiguration() {
            return new ConstrettoBuilder()
                    .createPropertiesStore()
                    .addResource(Resource.create("classpath:properties/test1.properties"))
                    .done()
                    .getConfiguration();
        }
    }
org.constretto

Constretto

Versions

Version
3.0.0-BETA1
2.2.3
2.2.2
2.2.1
2.2.0
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.4
2.0.3
2.0.2
2.0.1
2.0
2.0-rc-2
2.0-rc-1
2.0-beta-6
2.0-beta-5
2.0-beta-4
1.1.3
1.1.2
1.1.1
1.1
1.0.1
1.0