Tag Archives: Spring

Spring Data MongoDB Tutorial


Spring Data MongoDB Tutorial
// Kogonuso
By Amr Mohammed

Spring Data for MongoDB is part of the umbrella Spring Data project which aims to provide a familiar and consistent Spring-based programming model for new data stores while retaining store-specific features and capabilities.
The Spring Data MongoDB project provides integration with the MongoDB document database. Key functional areas of Spring Data MongoDB are a POJO centric model for interacting with a MongoDB DBCollection and easily writing a Repository style data access layer.

Spring Data provides a various methodologies when it comes integrating with the MongoDB, beyond using the MongoDB Template that’s supported by Spring, a Spring-Based repository concept is also used.

Regardless of the methodology that’s being used for integrating with the MongoDB, all of those aspects that you may looking for starting from easy configurable framework reaching into an efficient and productive using of those provided libraries are exist.
Here, you will find a proper explanation of integrating Spring Data with MongoDB by using Mongo Template or by using Spring Data repositories.

Testing Spring Data MongoDB Applications with NoSQL Unit


via One Jar To Rule Them All: Testing Spring Data MongoDB Applications with NoSQLUnit.

Spring Data MongoDB is the project within Spring Data project which provides an extension to the Spring programming model for writing applications that uses MongoDB as database.

IoT Realized: The Connected Car


via pivotal/IoT-ConnectedCar.

The internet of things (IoT) is one of the hottest buzzwords in 2015 and for good reason. The promise of leveraging data generated by machines that are interconnected can provide vast operational efficiencies in virtually every industry. At Pivotal’s SpringOne2GX conference 2014, a team from Pivotal demonstrated how components of Pivotal’s open source portfolio can be combined to increase speed to market of IoT solutions.

Pivotal has developed a sample application to illustrate it’s open source IoT platform via the use case of a connected car. In this demo, data from a moving vehicle is streamed real time to a server running Spring XD. Spring 😄 ingests the data and makes predictions about where the vehicle is going and how far it can go. An HTML/AngularJS based dashboard provides real time analytics illustrating the current position of the car, some of the basic telemetry available from the car as well as the predictions provided by Pivotal’s Data Science team.

This code repository consists of all of the source code used in the demo application’s server deployment. A separate repository for the iOS application used will be open sourced at a future date.

You can view the video of the SpringOne2GX demo online here: SpringOne2GX IoT-Realized: The Connected Car

Rest client calls with Spring Cloud


via all and sundry: Rest client calls with Spring Cloud.

There are a few interesting ways to make REST client calls with the Spring-Cloud project.
Spring-Cloud rest support builds on top of the core Netflix OSS libraries, but abstracts them and in the process simplifies using the libraries.

Learn Apache Camel – Indexing Tweets in Real-time


via Learn Apache Camel – Indexing Tweets in Real-time | Building scalable enterprise applications.

There’s a point in most software development projects when the application needs to start communicating with other applications or 3rd party components.

Whether it’s sending an email notification, calling an external api, writing to a file or migrating data from one place to another, you either roll out your own solution or leverage an existing framework.

As for existing frameworks in the Java ecosystem, on one end of the spectrum we find Tibco BusinessWorks and Mule ESB, and on the other end there’s Spring Integration and Apache Camel.

In this tutorial I’m going to introduce you to Apache Camel through a sample application that reads tweets from Twitter’s sample feed and indexes those tweets in real time using Elastic Search.

Session Timeout Handling on JSF AJAX request


via Programming Peacefully: Session Timeout Handling on JSF AJAX request.

When we develop JSF application with AJAX behaviour, we may experience the problem in handling timeout scenario of Ajax request. For example, if you are using J2EE Form-based authentication, a normal request should be redirected to the login page after session timeout. However, if your request is AJAX, the response could not be treated properly on the client-side. User will remain on the same page and does not aware that the session is expired.

Many people proposed solution for this issue. The followings are two of possible solutions involve the use of Spring security framework:
1. Oleg Varaksin’s post
2. Spring Security 3 and ICEfaces 3 Tutorial

Hazelcast Distributed Execution with Spring


via Hazelcast Distributed Execution with Spring | Online Technology Vision.

The ExecutorService feature had come with Java 5 and is under java.util.concurrent package. It extends the Executor interface and provides a thread pool functionality to execute asynchronous short tasks. Java Executor Service Types is suggested to look over basic ExecutorService implementation.

Also ThreadPoolExecutor is a very useful implementation of ExecutorService ınterface. It extendsAbstractExecutorService providing default implementations of ExecutorService execution methods. It provides improved performance when executing large numbers of asynchronous tasks and maintains basic statistics, such as the number of completed tasks. How to develop and monitor Thread Pool Services by using Spring is also suggested to investigate how to develop and monitor Thread Pool Services.

So far, we have just talked Undistributed Executor Service implementation. Let us also investigate Distributed Executor Service.

Hazelcast Distributed Executor Service feature is a distributed implementation of java.util.concurrent.ExecutorService. It allows to execute business logic in cluster. There are four alternative ways to realize it :

1) The logic can be executed on a specific cluster member which is chosen.
2) The logic can be executed on the member owning the key which is chosen.
3) The logic can be executed on the member Hazelcast will pick.
4) The logic can be executed on all or subset of the cluster members.

This article shows how to develop Distributed Executor Service via Hazelcast and Spring.

Used Technologies :

JDK 1.7.0_09
Spring 3.1.3
Hazelcast 2.4
Maven 3.0.4