DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Lessons Learned Moving From On-Prem to Cloud Native
  • Migrating Spring Java Applications to Azure App Service (Part 1: DataSources and Credentials)
  • How To Build Self-Hosted RSS Feed Reader Using Spring Boot and Redis
  • Main Features and Benefits of Google Kubernetes Engine

Trending

  • Debugging Core Dump Files on Linux - A Detailed Guide
  • Scaling Mobile App Performance: How We Cut Screen Load Time From 8s to 2s
  • Recurrent Workflows With Cloud Native Dapr Jobs
  • Scaling InfluxDB for High-Volume Reporting With Continuous Queries (CQs)
  1. DZone
  2. Coding
  3. Frameworks
  4. Creating Application using Spring Roo and Deploying on Google App Engine

Creating Application using Spring Roo and Deploying on Google App Engine

By 
Shekhar Gulati user avatar
Shekhar Gulati
·
Aug. 12, 22 · Interview
Likes (1)
Comment
Save
Tweet
Share
51.7K Views

Join the DZone community and get the full member experience.

Join For Free

Spring Roo is an rapid application development tool that helps you in rapidly building spring-based enterprise applications in the java programming language. Google app engine is a cloud computing technology that lets you run your application on Google's infrastructure. Using Spring Roo, you can develop applications that can be deployed on the Google app engine. In this tutorial, we will develop a simple application that can run on the Google app engine.

Roo configures and manages your application using the Roo shell. Roo shell can be launched as a stand-alone, command-line tool, or as a view pane in the Springsource tool suite ide.

Create it Fast and Effectively

 Most who create applications want to make them fast, and they want to make them effectively. What this means is that if they can figure out a way to create something that will both work for their users and also provide them with the speed of transaction that they need, then it is entirely possible that this will be precisely what they need to do in order to get the best results. 

Most are looking to Google search as a great way to get their apps out into the world, and it seems like this is as good of a place as any to start. Pushing out apps that can help the general population get the help they need with various projects means working with the most popular search engines in the world to make it happen. Thus, you should look to develop apps that work on Google in order to get the kind of results that you require.

Prerequisite

Before we can start using the Roo shell, we need to download and install all prerequisites.

  1. Download and install SpringSource Tool Suite 2.3.3. m2. Spring Roo 1.1.0.m2 comes bundled with STS. While installing STS, the installer asks for the location where STS should be installed. in that directory, it will create a folder with the name "roo-%release_number%" which will contain roo stuff. add %spring_roo%/roo-1.1.0.m2/bin in your path so that when you can fire roo commands from the command line.

  2. Start STS and go to the dashboard (help->dashboard)

  3. Click on the extensions tab

  4. Install the "google plugin for eclipse" and the "datanucleus plugin".

  5. Restart STS when prompted.

After installing all the above we can start building the application.

Conferenceregistration.roo Application

Conference registration is a simple application where speakers can register themselves and create a session they want to talk about. So, we will be having two entities: speaker and presentation. Follow the instructions to create the application:

  1. Open your operating system command-line shell

  2. Create a directory named conference-registration

  3. Go to the conference-registration directory in your command-line shell

  4. Fire Roo command. You will see a roo shell as shown below. Hint command gives you the next actions you can take to manage your application.
  5. Type the hint command and press enter.  Roo will tell you that first you need to create a project and for creating a project you should type 'project' and then hit tab. Hint command is very useful as you don't have to cram all the commands; it will always give you the next logical steps that you can take at that point.
  6. Roo hint command told us that we have to create the project so type the project command as shown below

     
    project --toplevelpackage com.shekhar.conference.registration --java 6

    This command created a new maven project with the top-level package name as com. Shekhar.conference.registration and created directories for storing source code and other resource files. In this command, we also specified that we are using Java version 6.

  7. Once you have created the project, type in the hint command again, Roo will tell you that now you have to set up the persistence. Type the following command
     
    persistence setup --provider datanucleus --database google_app_engine --applicationid roo-gae

    This command set up all the things required for persistence. It creates persistence.xml and adds all the dependencies required for persistence in pom.xml. We have chosen the provider as DataNucleus and the database as google_app_engine because we are developing our application for google app engine and it uses its own data store. Applicationid is also required when we deploy our application to the Google app engine. Now our persistence setup is completed.

    8. Type the hint command again, Roo will tell you that you have to create entities now. so, we need to create our entities' speaker and presentation. To create a speaker entity, we will type the following commands
     
    entity --class ~.domain.speaker --testautomatically
    
    field string --fieldname fullname --notnull
    
    field string --fieldname email --notnull --regexp ^([0-9a-za-z]([-.\w]*[0-9a-za-z])*@([0-9a-za-z][-\w]*[0-9a-za-z]\.)+[a-za-z]{2,9})$
    
    field string --fieldname city
    
    field date --fieldname birthdate --type java.util.date --notnull
    
    field string --fieldname bio

    The above six lines created an entity named session with different fields. In this, we have used notnull constraint, email regex validation, date field. Spring Roo on the app engine does not support enum and references yet which means that you can't define one-one or one-to-many relationships between entities yet. These capabilities are supported on spring MVC applications but spring MVC applications can't be deployed on app engines as of now. Spring Roo Jira has these issues. They will be fixed in future releases(hope so :) ).

    9. Next create the second entity of our application presentation. To create a presentation entity type the following commands on Roo shell
     
    entity --class ~.domain.presentation --testautomatically
    
    field string --fieldname title --notnull
    
    field string --fieldname description --notnull
    
    field string --fieldname speaker --notnull

    The above four lines created a jpa entity called presentation, located in the domain sub-package, and added three fields -- title,description and speaker. As you can see, the speaker is added as a string (just enter the full name). Spring Roo on google app engine still does not support references.

    10. Now that we have created our entities, we have to create the face of our application i.e. user interface. currently, only GWT-created UI runs on the app engine. so, we will create GWT user interface. To do that type
     
    gwt setup

    this command will add the GWT controller as well as all the UI required stuff. This command may take a couple of minutes if you don't have those dependencies in your maven repository.
    11. Next you can configure the log4j to debug level using the following command
     
    logging setup --level debug

    12. Quit the Roo shell
    13. You can easily run your application locally if you have maven installed on your system, simply type "mvn gwt:run" at your command line shell while you are in the same directory in which you created the project. This will launch the GWT development mode and you can test your application. Please note that applications do not run in the Google chrome browser when you run from your development environment. So, better run it in firefox.
    14. To deploy your application to the Google app engine just type
     
    mvn gwt:compile gae:deploy

    it will ask you for app engine credentials (email id and password).
application Google App Engine app Spring Roo Engine Google (verb) Spring Framework Command (computing)

Opinions expressed by DZone contributors are their own.

Related

  • Lessons Learned Moving From On-Prem to Cloud Native
  • Migrating Spring Java Applications to Azure App Service (Part 1: DataSources and Credentials)
  • How To Build Self-Hosted RSS Feed Reader Using Spring Boot and Redis
  • Main Features and Benefits of Google Kubernetes Engine

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!