Skip to content

UsingSpringWithOGNL

Sebastian Hoß edited this page Oct 5, 2013 · 5 revisions

To use Spring together with OGNL, declare the following dependency and replace ${contracts-version} with the latest release

<dependencies>
  <dependency>
    <groupId>com.github.sebhoss.contract</groupId>
    <artifactId>contract-spring-ognl</artifactId>
    <version>${contracts-version}</version>
  </dependency>
</dependencies>

then import the provided OGNL configuration

import com.github.sebhoss.contract.configuration.DefaultOGNLConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import(DefaultOGNLConfiguration.class)
public class CompanySpringConfiguration {

    // .. your bindings

}

and annotate your business methods as usual using OGNL. Consult the example project for more details.