Skip to main content

Posts

Showing posts from April, 2011

Single Spring Application Deployment for both Local and CloudFoundry.com Servers

In my previous post I showed how it’s possible, using Spring 3.0, to deploy a database application to CloudFoundry.com and what changes are needed for a CloudFoundry.com datasource.  In this post, I’m going to show how a Spring 3.1 application can be configured at runtime to use either a local MySQL database or a CloudFoundry.com MySQL database thus allowing a single deployable Spring application to be deployed either locally or on CloudFoundry.com. Deploying a Spring application to CloudFoundry.com does not mandate the use of Spring 3.1, however Spring 3.1 makes the process much easier due to the new profile features. So, first off, we must upgrade to Spring 3.1 Upgrading to Spring 3.1 To upgrade a Spring STS application to use Spring 3.1 is an easy procedure. In the project’s pom.xml file, we first need to change the version number of Spring to 3.1.0.M1. I say it’s easy with a STS application as everything else (for example, Spring’s Milestone Maven repository) is already p...

NetBeans 7.0 Released

After nearly 6 months of beta testing, NetBeans 7.0 has been released and is now available for download from the NetBeans site. As usual, the Java SE, Java EE, C/C++ and PHP packages are available for download together with a package that contains all NetBeans modules. Additional functionality can be added to any of the base packages using the buildin Plugin Manager. NetBeans 7 provides many new features including: Language support for Java SE 7 new features (JSR 344) available with the JDK 7 developer preview. Enhanced integration with WebLogic, GlassFish and Oracle database. Enhanced support for Swing GUI development Maven 3 support HTML 5 editing support. To support NetBeans 7, a new plugin portal has also been released. The NetBeans team describe the new portal as using: " modern web technologies ; features powerful searching capabilities and improved performance ; provides an optimized user interface ; and has resolved many design drawbacks of its predecessor....

Deploying Spring Database Apps to CloudFoundry.com

Deploying Spring applications to CloudFoundry.com really is as easy as SpringSource say it is. After being approved for a Cloud Foundry beta account, the first stage is to install Cloud Foundry support into STS or Eclipse. Christian Dupuis has an excellent blog post on how to achieve this, so I won't re-iterate what he has already said. To deploy and run an application using a datasource, MySQL in my case, requires a bit more effort than deploying a standalone application, but literally very little. To deploy an application with a datasource, you must first declare which datasource to use.  In Eclipse, open up the Cloud Foundry server and press the "Add" button on the services pane. On the following screen, select a name and type for the datasource. Press the "Finish" button and the datasource is registered. After registering a datasource, you need to tell the application which datasource to use.  This is as straightforward as draggin...

Converting a Spring SimpleFormController into an @Controller

In my previous post , I showed how to convert a Spring web controller class to use the @Controller annotation. In this post, I aim to show how forms in a Spring MVC application can also be converted to using annotations. Forms in Spring are typically modelled by extending the org.springframework.web.servlet.mvc.SimpleFormController class, but using Spring annotations, they can also be simplified and defined by the @Controller annotation. Without annotations, a SimpleFormController would be defined as below as in both a Java class and as a bean in XML. import org.springframework.web.servlet.mvc.SimpleFormController   public class PriceIncreaseFormController extends SimpleFormController {       public ModelAndView onSubmit(Object command) {         // Submit the form     }           protected Object formBackingObject(HttpServletRequest request)         throws ServletException { ...

Converting a Spring Controller into a @Controller

In the Spring Web Framework, its typical to implement a Controller as a class that implements org.springframework.web.servlet.mvc.Controller, for example: public class InventoryController implements Controller { public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Handle the request here } } This class would then be defined within an application's Spring context XML file (typically appname-servlet.xml) <bean name="/home.htm" class="springapp.web.InventoryController"> ... </bean> Using Spring annotations however, its possible to remove the need to implement the org.springframework.web.servlet.mvc.controller and remove the bean definition within the XML file. To change the Controller class to use annotations, the class needs to be annotated with the @Controller and @RequestMapping annotations a...

Is NetBeans 7.0 Ready for Release?

Now that NetBeans 7 Release Candidate has been released , the NetBeans team are asking for your thoughts as to whether the software is stable for general release. The NetBeans Community Acceptance Survey  provides invaluable information to the NetBeans team about the stability and new features added into NetBeans 7. If you're using NetBeans 7 RC, please consider completing the survey.

Seam 3 Final Released

Shane Bryzak has today announced the release of Seam 3. Seam 3 is a modular collection of extensions to Java EE 6 based upon CDI which can be downloaded individually  or as a complete bundle .  Shane describes Seam 3's goal as: "to enable developers to create rich, standards-based internet applications by solving many of the challenges encountered when developing software in today's connected world." Seam 3 contains many components to help developers build web applications including components for JSF, Wicket, Security, Persistence and more.  A full list of modules and their descriptions can be found at the Seam project site . Seam 3 will work with ant Java EE 6 compatible application server such as JBoss AS or GlassFish 3.1 or by any servlet container with the Weld servlet extension.