Skip to content

Commit

Permalink
Downgrade version to latest stable, add missing dependencies, apply n…
Browse files Browse the repository at this point in the history
…aming convention
  • Loading branch information
tomnocon committed Jul 24, 2017
1 parent 36dc2cd commit 72629ce
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
15 changes: 13 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M2</version>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -29,6 +29,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
Expand All @@ -41,7 +49,10 @@
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/nocotom/dm/bootstrap/MongoDbBootstrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
import com.mongodb.MongoClientURI;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.nocotom.dm.configuration.MongoDbConfiguration;
import com.nocotom.dm.configuration.MongoDbProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan(basePackages = {"com.nocotom.dm.configuration"} )
@ComponentScan(basePackages = {"com.nocotom.dm.configuration"})
public class MongoDbBootstrapper {

@Bean
public MongoDatabase bootstrapDatabase(final MongoDbConfiguration configuration){
public MongoDatabase bootstrapDatabase(final MongoDbProperties configuration) {
String uri = String.format("mongodb://%s:%s", configuration.getHost(), configuration.getPort());
MongoClient client = new MongoClient(new MongoClientURI(uri));
return client.getDatabase(configuration.getDatabaseName());
}

@Bean
public MongoCollection bootstrapCollection(final MongoDbConfiguration configuration,
final MongoDatabase database){
public MongoCollection bootstrapCollection(final MongoDbProperties configuration,
final MongoDatabase database) {
return database.getCollection(configuration.getCollectionName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Getter
@Setter
@Component
@ConfigurationProperties("mongo-db")
public class MongoDbConfiguration {
public class MongoDbProperties {

private static final int DEFAULT_MONGO_DB_PORT = 27017;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Getter
@Setter
@Component
@ConfigurationProperties("mqtt-broker")
public class MqttBrokerConfiguration {
public class MqttBrokerProperties {

private static final int DEFAULT_MQTT_BROKER_PORT = 1883;

Expand Down

0 comments on commit 72629ce

Please sign in to comment.