Spring Data MongoDB 1.0.0 M4 released

News | Oliver Drotbohm | September 02, 2011 | ...

Dear Spring Community,

I am pleased to announce the availability of Spring Data MongoDB 1.0.0 M4. Here are the most important features added:

  • Support for map-reduce operations in MongoTemplate
  • Provided means to use externalized queries to be executed by repositories
  • Support for geoNear queries on MongoTemplate and the repositories
  • New DocumentCallbackHandler interface on MongoTemplate
  • A DB wide WriteConcern can now be configured on the SimpleDbFactory
  • A WriteConcern configurable on MongoFactoryBean
  • Added a QuerydslRepositorySupport base class to ease implementing Querydsl based repositories
  • Configurable TypeMapper interface to control how type information is written and retrieved to and from Mongo documents

Beyond that we ship a ton of bug fixes and improvements mostly around the mapping subsystem and performance. For a detailed list of tickets fixed have a look at the changelog.

Downloads | JavaDocs | Reference Documentation | Changelog

To learn more about the project, visit the Spring Data MongoDB Page. Looking forward to your feedback on the forum or in the issue tracker.

This week in Spring: August 30th, 2011

Engineering | Josh Long | August 31, 2011 | ...

Welcome to another edition of "This Week in Spring" There's a lot to get to, so we'll get to it. A quick note: if you're at VMworld 2011 in sunny Las Vegas, come on over to the Cloud Application Platform booth and say hi.

  1. What a week for CloudFoundry! The week saw the release and availability of Micro Cloud Foundry, the freely downloadable "PaaS-on-a-stick." Micro Cloud Foundry is a complete, local version of the popular, open source Platform as a Service that lets developers run a full featured cloud on their Mac or PC. Using Micro Cloud Foundry developers can build end-to-end cloud applications locally, without the hassles of configuring middleware while preserving the choice of where to deploy and the ability to scale their applications without changing a line of code.

    To learn more about the Micro Cloud Foundry, check out these three blog posts introducing Micro Cloud Foundry to Spring developers and Grails developers, and introducing the support for Micro CloudFoundry in SpringSource Tool Suite.

    	</li> 
    	
    	<LI>Thomas Risberg blogged today about <A HREF="http://blog.springsource.com/2011/08/30/using-postgres-on-cloud-foundry/">using PostgreSQL on Cloud Foundry</a>. The recently announced  PostgreSQL support   makes CloudFoundry the natural place to deploy your enterprise applications: between MySQL and PostgreSQL there's very likely few speed or feature…

Using Postgres on Cloud Foundry

Engineering | Thomas Risberg | August 30, 2011 | ...

When the new open source Platform-as-a-Service (PaaS) offering Cloud Foundry from VMware launched earlier this year, it included a relational database service powered by MySQL along with the NOSQL options of MongoDB and Redis. One of the promises of the Open PaaS is to provide choice both in languages and frameworks you can develop with and in the database services that are available to use. We now have a new relational database service using PostgreSQL available. This is great since we can now choose between the two most popular open source relational databases. PostgreSQL is is a very…

RabbitMQ: Enabling Grails full text search on Cloud Foundry

Engineering | Peter Ledbrook | August 29, 2011 | ...

In my second blog about Grails and Cloud Foundry I introduced a variant of the Grails Twitter example that could be hosted on CloudFoundry.com At the time I mentioned that full text search using the Searchable plugin would limit you to a single application instance because the search indices would be unique to each instance. In other words, you might very easily get different search results depending on which application instance your browser is routed to.

I also said that one option for fixing this problem would be to synchronise the search indices across the instances. But that doesn't sound…

Clean Code in Android Applications

Engineering | Roy Clarkson | August 26, 2011 | ...

Let's say you wake up one morning, and think, "Hey, I'm going to build an Android app today." First off, good choice! As of the end of June, 500,000 Android devices were being activated every day, outpacing even the iPhone. That means there is a large, potential audience for your app. Additionally, Android is built with Java. This may not seem like a big deal, but I have worked in Objective-C on the iOS platform for a few years, and while I am now quite comfortable with it, the iOS SDK offered a steeper learning curve than I experienced with Android. Android just felt more accessible when I first started working with the Android SDK. That said, there are some clear differences from any other Java application you have built in the past, and I'll go over some of those in the first section.

So moving forward in time, you have completed your first app, and have submitted it to the Android Market. Congratulations are in order, as your friends are all downloading your app and tweeting about it. Now it is time to start on your second app. You spend a few days, and suddenly realize that you are starting to reuse code from your first app, which in itself is not a bad thing. Code reuse can be valuable. But you notice there is a lot of boilerplate code that tends to be repeated often, and that can be distracting from focusing on your business logic. Fortunately, there are some ways to improve upon this.

In this blog post, I will provide an overview of Android and the application lifecycle, and discuss some of the limitations imposed by the framework. I will also review a few of the techniques and third party projects that can help you clean up your Android code, and focus on what you want to achieve with your app.

Android Overview

Let's begin with a brief overview of how Android works. Android applications (apps) are built using Java, and compiled to class files. The class files are then compiled into the Dalvik Executable (DEX) format, so they may run on the Dalvik virtual machine used by Android. After conversion to DEX format, the class files are zipped to an Android Package (APK) for distribution to devices. Because of the use of the DEX format, the Dalvik VM is not a true Java Virtual Machine, since it does not operate on Java byte code. Additionally, the Dalvik VM is based on a subset of the Apache Harmony project for its core class library. This means that many of the classes and methods to which you are accustomed in Java SE are available, but certainly not all. I have found the API reference on the Android developer web site to be an invaluable resource for reviewing these differences.

By default, each Android application is assigned a unique Linux user ID by the Android operating system. When started by the system, an application runs in its own Linux process, within its own virtual machine (VM). The system manages the starting and shutting down of this process when needed. As you can guess, this means that each application runs in isolation from the other running applications. When installed, an app can request permission to access hardware features or interact with other applications. The user elects to grant these permissions to the app or to not install it. The permissions required or requested by an app are defined in each app's Android Manifest file. This is an XML file that lists all the components of the app, and any settings for those components. The four types of application components are activities, services, content providers, and broadcast receivers. For the purposes of this post, I will be focusing on activities.

Activities basically represent a single screen of an Android application. For example, a Twitter app may have a login screen, a screen with a list of tweets, and a screen for authoring a new tweet. Each of these screens represent different activities within the application. As a developer you never instantiate an activity object yourself. Activities are activated by sending an asynchronous message called an Intent, as seen in the example below.


startActivity(new Intent(context, HomeActivity.class));

When startActivity(Intent intent) is called, the system either creates a new instance or reuses an existing one in order to display the activity to the user. The important point is that the system controls the starting and stopping, and creation and destroying of the application and each activity. If you want to interact with this process, then the application and activity classes provide methods for different lifecycle events that you can override in a subclass.

Dependency Injection

The Spring Android project recently reached its fourth milestone release. With that release we have continued to improve upon the RestTemplate and Spring Social support for Android, which simplifies the process of making RESTful HTTP requests and accessing REST APIs secured by OAuth. And while we believe these are valuable additions for Android development, some developers have asked questions regarding the possibility of dependency injection support in Spring Android, because as you are probably aware, the Spring Framework already provides a popular Inversion of Control (IOC) container for enabling dependency injection in enterprise Java applications. Early in the Spring Android planning stages, dependency injection support was identified as a potential candidate for inclusion in the project. At that point, it was unclear what that support would entail, and how it would be implemented. Because of this, I began the process of researching and investigating the possible methods available for, and limitations of, performing dependency injection in Android.

Well, what is dependency injection? If you ask two different developers, you may get two different answers. You might hear about IOC, XML files, annotations, or some other implementation detail. In reality, dependency injection is simply a technique to reduce coupling by handing an object what it needs to work, rather than having the object reach out into its environment. That sounds easy enough, and you might be thinking to yourself you can already get this with class constructors and setter methods, which is completely true. However, recall from the overview section above, the Android system drives the application lifecycle, so the way we can do this is limited.

The Android Way

Without using any third party libraries, it is rather easy to pass a dependency to an Activity. As discussed earlier, the system creates the application instance. So by extending application, you can effectively create a singleton dependency instance, which can then be accessed by any of the activities in the app.


public class MainApplication extends Application  {

    private MyService service;

    @Override
    public void onCreate() {
        super.onCreate();
        service = new MyServiceImpl();
    }

    public MyService getMyService() {
        return this.service;
    }
}

The activity class has a method called getApplication() which returns a reference to the application object that owns the activity. We simply cast it to MainApplication, and we can access the getter method for the MyService. Of course, the activity now has to "know" about the application, which might seem like a disadvantage. But remember, the activity already knows about its application. The method is built in.


public class MainActivity extends Activity  {

    private MyService service;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MainApplication app = (MainApplication…

Feature Tour

Releases | Chloe Jackson | August 26, 2011 | ...

Spring enables you to focus on your business problem rather than the plumbing that connects components and systems. Take a tour of Spring’s key features from the core framework to infrastructure and data services and learn how to build, run and manage your modern Java applications. Getting started is easy and you can do it now.

 

Spring Framework Features

The Spring Framework helps you build Java Applications faster because it allows you to focus on your business problem rather than the plumbing code that connects components and systems. The features of Spring include:

Modern Web

Complete support for modern applications including REST, HTML 5, conversations and AJAX.
See more...

Data Access

Supports traditional RDBMS as well as new NoSQL solutions, map-reduce frameworks and cloud based data services.
See more...

Integration

Enterprise orchestration and adapters for distributed applications, asynchronous message-based applications, and batch applications.
See more...

Mobile

Web support for mobile client platforms including Android and iPhone.
See more...

Social

Integration with Facebook, Twitter, LinkedIn, and other prominent social networks.
See more...

Security

Authorization control for all tiers and authentication integration to dozens of providers.
See more...

Cloud Ready

Spring applications are supported on all popular cloud platforms like Cloud Foundry, Google App Engine and Amazon EC2.
See more...

   

Spring Key Benefits


Modularity

Plain old Java Objects keep your code concise, simple and modular

 

Productivity

Over 70% of developers report productivity gains and reduction in time to deploy with Spring

 

Portability

Applications run on Tomcat, all Java EE servers as well as cloud platforms

 

Testability

Cleanly expressed dependencies make unit and integration testing easier

 

Get Started With Spring

News | Chloe Jackson | August 26, 2011 | ...

Spring provides an incredibly powerful and flexible collection of technologies to improve your enterprise Java application development that is used by millions of developers. It is easy to get started by using our free development tool, Spring Tool Suite, or following one of the many tutorials. If you have specific questions then you can ask them in the community forum, look for a solution in our extensive code samples or search the outstanding Spring documentation.

 

Get Everything You Need

Spring Tool Suite™ provides the best Eclipse-based development environment for building Spring-powered enterprise applications. STS supplies all the tools you need for developing with the latest enterprise Java and Spring based technologies.

Start a Tutorial

If you are new to Spring or need to learn about a new feature, our tutorials explain key concepts simply and provide step by step instructions on how to accomplish specific tasks. With screencasts, example code and expert tips, you can master Spring at your own pace.
Go to Tutorials...

 

Grab a Code Sample

Spring code samples give you precise code that you can use directly in your applications. Samples written by the Spring experts and make sure that your applications are the following best practices.
Go to Samples...

 

Read the Documentation

Spring documentation covers every aspect of the platform in exacting detail. If you need to find specific information about the APIs or understand how Spring works internally, then search through our comprehensive and deep technical publications.
Go to Documentation...

Ask a Question (Forums)

Have a question? The Spring forums are a vibrant resource with thousands of users asking and answering questions every day.
Go to the Forums...

 

Take a Class (Training)

SpringSource University is your ultimate source for developer-focused education. You can take our open-source classes in a classroom setting or live, online to get a better understanding of the Spring Framework, Apache Tomcat and other open source projects and get Spring Certified.
Go to Training...

 

Video Instruction

The SpringSourceDev YouTube channel provides a complete video archive of Spring presentations and technical screencasts. These recordings by Spring experts give you development guides and tips for all skill levels.
Go to the Channel...

 

Spring AMQP 1.0 GA released

Releases | Mark Fisher | August 25, 2011 | ...

We are pleased to announce that Spring AMQP 1.0 GA (for Java) has been released! You can find links to all of the resources (documentation, samples, source code, forum, issue tracker, etc) at the Spring AMQP Home Page. The artifacts are available in the SpringSource Maven repository as well as Maven Central.

This project has been extremely popular during its milestone and release-candidate phases, and we would like to thank those of you in the community who have provided valuable feedback and raised JIRA issues along the way. We are looking forward to watching the community grow even more now…

Spring Social 1.0.0.RC3 Released

Releases | Craig Walls | August 25, 2011 | ...

Dear Spring Community,

We are pleased to announce the 1.0.0.RC3 release of Spring Social, including the 1.0.0.RC3 releases of Spring Social Facebook and Spring Social Twitter. Spring Social lets you connect your Java applications to Software-as-a-Service (SaaS) providers such as Facebook and Twitter.

This release includes fixes for bugs reported since 1.0.0.RC2, as well as a few improvements:

  • ConnectInterceptor implementations can now add parameters to the authorization URL.
  • Twitter TimelineOperations.updateStatus() improvements:
    • Photos can now be uploaded along with a status update.
    • TimelineOperations.updateStatus() now returns a Tweet object for the newly posted tweet.
    • A status can now be posted as being a reply to an existing status.
  • The set of sample applications has been updated, including two new examples: One to demonstrate a popup-based connection flow and another to demonstrate using Spring Social within a Facebook Canvas application.

See the change logs for more information on what's new in this release (Core | Facebook | Twitter)

To get the software, download the release distribution (Core | Facebook | Twitter) or simply add the maven artifacts to your project. To see it live, run through the quickstart and spin up the showcase app (updated for 1.0.0.RC3). Supplement as you go with information from the reference manual.

Spring Social requires Spring Framework 3.0.5 or > to run. We recommend Spring 3.1 for new applications to take advantage of the latest advances in the core framework. See the reference manual for a full description of dependencies.

We expect this to be the last release candidate for Spring Social 1.0.0 and anticipate a Spring Social 1.0.0 GA release very soon. For that reason, we urge you to try out this release candidate and give us feedback in the forum or, if you have any suggestions or find any bugs, post them in the issue tracker.

We hope you enjoy using Spring Social!

Spring 3.0.6 is Now Available

Releases | Adam Fitzgerald | August 24, 2011 | ...

With so much of the focus on the new features in Spring 3.1, it is important to remember that the 3.0.x branch is still being updated. Sneaking in under the radar last week, we saw the release of Spring 3.0.6. This release addresses over 50 minor issues and includes about a dozen small improvements. Be sure to read the Change Log for all the details.

Download | Documentation | Javadoc API | Change Log | JIRA

Don't forget that Spring users can ask questions in the community forum and identify issues in JIRA as well.

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all