Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea
*.iml
**/.idea/
**/*.iml

*.classpath
*.project

target
**/target/
54 changes: 23 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Dropwizard/Spring
===================================

[ ![Codeship Status for nhuray/dropwizard-spring](https://www.codeship.io/projects/aaabb970-44fc-0132-2a3e-3e77b90e182a/status)](https://www.codeship.io/projects/44910)

Welcome to the Dropwizard/Spring project
Welcome to the Dropwizard/Spring project. This is a updated version of the work done by Nicolas Huray at [https://github.com/nhuray/dropwizard-spring](https://github.com/nhuray/dropwizard-spring) .


Introduction
Expand All @@ -19,20 +17,22 @@ This project provide a simple method for integrating Spring with Dropwizard.
Versions
------------

The current version of the project is **0.2**.
The latest version of the project available on Maven repository is **0.2**.

| dropwizard-spring | Dropwizard | Spring |
|:------------------:|:------------:|:-------------:|
| master (0.3.4) | 0.8.1 | 4.1.6.RELEASE |
| master (0.3.2) | 0.7.0 | 4.0.5.RELEASE |
| master (0.3.1) | 0.6.2 | 3.1.4.RELEASE |
| 0.2 | 0.6.0 | 3.1.3.RELEASE |
| 0.1 | 0.5.1 | 3.1.1.RELEASE |

The latest available release is **0.3.4**.


Installation
------------


To install Dropwizard/Spring you just have to add this Maven dependency in your project :

```xml
Expand All @@ -43,6 +43,12 @@ To install Dropwizard/Spring you just have to add this Maven dependency in your
</dependency>
```

To install a newer release, download the jar and added it to your local maven repository. Execute this command in the same folder as the jar:

```
mvn install:install-file -Dfile=dropwizard-spring-0.3.4-RELEASE.jar -DgroupId=com.github.raduciumag -DartifactId=dropwizard-spring -Dversion=0.3.4-RELEASE -Dpackaging=jar
```

Usage
------------

Expand All @@ -53,31 +59,17 @@ To use Dropwizard/Spring you just have to add a ```SpringBundle``` and create yo
For example :

```java
public class HelloApp extends Service<HelloAppConfiguration> {

private static final String CONFIGURATION_FILE = "src/test/resources/hello/hello.yml";

public static void main(String[] args) throws Exception {
new HelloApp().run(new String[]{"server", CONFIGURATION_FILE});
}

@Override
public void initialize(Bootstrap<HelloAppConfiguration> bootstrap) {
// register configuration, environment and placeholder
bootstrap.addBundle(new SpringBundle(applicationContext(), true, true, true));
}

@Override
public void run(HelloAppConfiguration configuration, Environment environment) throws Exception {
// doing nothing
}

@Override
public void initialize(Bootstrap<HelloAppConfiguration> bootstrap) {
// register configuration, environment and placeholder
bootstrap.addBundle(new SpringBundle(applicationContext(), true, true, true));
}

private ConfigurableApplicationContext applicationContext() throws BeansException {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.scan("hello");
return context;
}
private ConfigurableApplicationContext applicationContext() throws BeansException {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.scan("hello");
return context;
}
```

Expand All @@ -87,11 +79,11 @@ The ```SpringBundle``` class use the application context to initialize Dropwizar

Moreover the ```SpringBundle``` class register :

- a ```ConfigurationPlaceholderConfigurer``` to resolve Dropwizard configuration as [Spring placeholders](http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/beans.html#beans-factory-placeholderconfigurer) (For example : ```${http.port}```).
- a ```ConfigurationPlaceholderConfigurer``` to resolve Dropwizard configuration (For example : ```${http.port}```).

- the Dropwizard configuration with the name ```dw``` to retrieve complex configuration with [Spring Expression Language](http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/expressions.html) (For example : ```#{dw.httpConfiguration}```).
- the Dropwizard configuration with the name ```dw``` to retrieve complex configuration (For example : ```#{dw.httpConfiguration}```).

- the Dropwizard environment with the name ```dwEnv``` to retrieve complex configuration with [Spring Expression Language](http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/expressions.html) (For example : ```#{dwEnv.validator}```).
- the Dropwizard environment with the name ```dwEnv``` to retrieve complex configuration (For example : ```#{dwEnv.validator}```).

Please take a look at the hello application located in ```src/test/java/hello```.

Expand Down
57 changes: 21 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.github.nhuray</groupId>

<groupId>com.github.raduciumag</groupId>
<artifactId>dropwizard-spring</artifactId>
<version>0.3.2-SNAPSHOT</version>
<packaging>jar</packaging>
<version>0.3.5-SNAPSHOT</version>

<name>Dropwizard/Spring integration</name>
<description>Dropwizard/Spring integration</description>

<scm>
<connection>scm:git:git@github.com:41quickbuild/dropwizard-spring.git</connection>
<url>git@github.com:41quickbuild/dropwizard-spring</url>
<developerConnection>scm:git:git@github.com:41quickbuild/dropwizard-spring.git</developerConnection>
</scm>

<issueManagement>
<system>JIRA</system>
<url>http://jira</url>
</issueManagement>

<ciManagement>
<system>Bamboo</system>
<url>http://bamboo/bamboo</url>
</ciManagement>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand All @@ -43,39 +31,36 @@
<url>https://github.com/nhuray/</url>
<timezone>+1</timezone>
</developer>
<developer>
<id>raduciumag</id>
<name>Radu Ciumag</name>
<url>https://github.com/RaduCiumag</url>
<timezone>+2</timezone>
</developer>
</developers>

<distributionManagement>
<repository>
<id>nexus</id>
<url>http://nexus.the41.internal/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<url>http://nexus.the41.internal/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

<properties>
<dropwizard.version>0.7.0</dropwizard.version>
<spring.version>4.0.5.RELEASE</spring.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<guava.version>17.0</guava.version>

<dropwizard.version>0.8.1</dropwizard.version>
<guava.version>18.0</guava.version>
<spring.version>4.1.6.RELEASE</spring.version>
</properties>

<dependencies>

<!-- Compile Dependencies -->
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>

<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-lifecycle</artifactId>
<version>${dropwizard.version}</version>
</dependency>

<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-servlets</artifactId>
Expand All @@ -102,20 +87,21 @@
<version>4.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>

<!-- CGLIB, only required and used for @Configuration usage -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand All @@ -127,7 +113,6 @@
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
Expand Down
Loading