Spring 4 vs Grails - Open Source Plugins - spring

I have used spring 3 but not sure what is the equivalent of a grails plugin. And now need to suggest a stack for a new app. Looking at grails it seems to be great for making data base models and has a lot of plugins. but it seems its more expensive at runtime.
So my question is that is there a equal or better repo of spring for every little thing you can need like facebook login or other social actions, ajax upload, joda etc or is this what we call a dependency and some code from a blog/ stack?
Is there any repo of small reusable code like we have on grails plug ins for regular spring mvc projects?

I know that your question is about pure spring alternatives, but I would honestly recommend just using Grails. I've done projects in both stacks. If you want to get rid of the configuration headaches and get started quickly on a new project while staying within the Spring stack, it is the way to go. It is a great framework and some of my employers have many production Grails applications supporting thousands of customers.
You can also upgrade to Grails 3 when it comes out next year and take advantage of the leaner code they provide in it due to Spring Boot!

You may need to check into Spring Boot. It does not provide a full stack framework, but it is hiding much of the extra coding you may need to do for a spring application. There are some new projects that enable you to get the benefits of spring boot. Check the below projects:
1- http://jhipster.github.io/ , use it if you need to make SPA with AngularJS also have commands to generate Entities for you using Yeoman
2- http://lightadmin.org/ , use it if you want to create CRUD pages based on Spring Data Entities
For both, you may have to use Spring Data and maybe even Spring Data REST. These may be helpful too.

Related

GWT/GAE Spring IoC powered

I'm trying to put together Google App Engine and Google Web Toolkit for one of my projects.
I think I'm going to use Objectify for data persistence, too.
The guys of Springsource says that integrate those technology with Spring is possible.
Do you know where can I find some sort of tutorial about that?
Spring + GAE == slow start up for every instance.
You will face performance problems.
In my project I had to get get rid of Spring once we had everything implemented :(
I wont use Spring + gae anymore
There is no any extra stuff required, no special configurations, tricks, etc. If you know both Spring and GAE - just use it, it's pretty standard.
I've few project based on Spring+GAE+Objectify+Java/Groovy - everything working fine together.
update:
Spring is good only for server-side part. As you want to use IoC on client side (in GWT part), you can use Google GIN instead. It's Google Guice framework (IoC from Google) designed for using with GWT.
See http://code.google.com/p/google-gin/

Cannot proceed with Spring Roo: Advaned MVC Problems

I was scheduled to begin work on a new project and decided to make my life easier by adopting a new technology that I had no experience with: Spring!
Specifically Spring Roo, and therein lies my problem.
Spring Roo does so much auto-magical stuff that I really do not know how to proceed. As this runs the risk of turning into a rant, let me be more specific and then follow it up with my question:
Spring works great for setting up my classes and persisting them with Hibernate and all that. The main problem I am having is in trying to scaffold my project.
I am working on a project that manages a few "set" references with many-to-many and many-to-one relationships. This immediately will have problem with the scaffolding application.
Trying to add Google Web Toolkit via 'gwt setup' kills the application immediately. Trying to load in Tomcat server becomes impossible and there is no way to undo the process (as far as I know). Now what? I have to restart my project from the original commands and reapply my changes as far as I can tell.
With this being said it seems to me that the best process is to use ROO to generate my project artifacts and then create my own View/Controller setup. Even here I am having problems though, because the tiles configuration seems so obscured from how it works. I am having a hard time figuring out how to take a custom JSP that can process some of these complex many-to-one relationships (AJAX enabled) and add it to my web front.
Are there any guides for this?
FYI: in the existing Roo Generated MVC I tried
Copying over my JSP
Creating a Form Backing Objects that wraps the different entity types
Modifying the views.xml file in the folder to recognize the page
One this was accomplished, though, I have been unsure how to proceed. How do I access my JSP? Manually typing the URL as it is defined in views.xml does not work.
Should I think about abandoning Roo altogether and starting a Spring project from scratch?
Bet way to learn Spring Roo
read documentation (Spring Roo, enter link description here)
experiment with Roo and watch console output. See files that change, what changes if you add new controller etc.
read and discuss matters in SpringSource forum
follow spring-roo tag in SO
Using Spring Roo for scaffolding
user version control system or backup project. If result does not satisfies you - rollback changes.
Eclipse or SpringSource Tool suite have have hiccups (1, 2). Be aware of them. Use mvn eclipse:clean eclipse:eclipse and re-import project if necessarily.
know the difference between MVC architectural pattern, Web MVC framework and GWT scaffold application.
know limitations and behaviour of scaffolding (ITDs: GWT Style, Expected GWT Add-On Behaviour, JSP Views)
know how Validation, Data Binding, and Type Conversion works, to use effetely in your views
investigate request pipeline (Adding a custom page in spring roo, Adding new Activity in GWT scaffolded app)

Migrating from Struts2 to Spring MVC

Scenario: A fairly mature project uses Struts2 and Spring and Hibernate. I say mature because it has been going on a for a while and there are many struts actions written already.
Suppose we wanted to remove Struts2 from the project and instead depend entirely on Spring MVC without rewriting the entire project.
Is this something that should even be considered?
Are there any migration guides out there?
Has anyone done this before and would like to warn me against it?
If it ain't broke, don't fix it. You have very likely better things to do than a migration that won't add any value to the product (and will certainly introduce some bugs). If I were the business, I would never buy such a migration (with close to zero benefits).
I have to ask: What advantages do you see with Spring MVC that aren't being fulfilled by Struts 2?
If there's not at least a handful of "smoking hot" features, or the amount of time saved is more than enough to overcome the time taken for the migration in the first place then it's probably best to stick with what you have.
You can do it slowly. Struts is a MVC framework. The rest of your application (business and data tiers) are classes which can be invoked by action classes. Struts is a plugin based architecture and it is easy for you to define a plugin in struts configuration file.
Take a look at this link. This may help.
With Struts2 security vulnerabilities being exposed and reported often, this task takes on more importance.

Spring roo Vs (Wicket and Spring)

Spring roo is new framework and I found it very interesting. I have been working on web application for last 3-4 years and Always found JSPs are hard to maintain across teams if everyone is not disciplined enough about separation of markup and serverside logic. I have used JackBe/BackBase in last projects and I enjoyed xml templates working as views. This was much better than JSPs. But I couldnt automate webtests through selenium for backbase.
I would be surely using Spring MVC (-view), Hibernate on the backend. I found Wicket as good alternative. Have you used wicket along with Spring and what was your experience?
First, Spring Roo is a code generator tool (similar to Grails commands system):
(source: springsource.com)
Second, Spring Roo applications currently use Spring Web Flow for the view and Spring for the glue.
So, while you can compare (Spring Web Flow + Spring) and (Wicket + Spring), the later combo doesn't offer anything comparable to Roo out of the box (maybe AppFuse or AppFuse Light but you didn't mention them and they are third-party projects).
In other words, I don't think that "Spring Roo vs (Wicket and Spring)" makes sense.
Our current project uses Spring and Wicket, we have always used Spring but switched to Wicket a year ago. Few advices:
Get the "Wicket in Action" book.
The user mailing list is very helpful.
Make sure you understand Wicket's programming model especially the session serialization related stuff (the book does not help enough in this area IMHO).
Wicket is good at building stateful pages, it requires more work to build stateless pages.
There are some good UI widgets available like inmethod DataGrid.
It's easy to inject your Spring beans in your pages or components.
Spring Roo is still in beta (1.0 M2), so it may be a little early.
We also considered Tapestry 5 but we thought it was a bit young a year ago.
Spring Roo 1.0.0 (GA) has now been released, complete with around 100 pages of documentation.
If you're wondering about what Roo is and why use it, I recommend you take a read of the introductory chapter of the reference guide. It covers this and more.
#Antony, GWT support is a major priority for Roo and something I am currently working on. Expect to see some interesting integration in the very near future.
I was at the SpringOne conference in Amsterdam earlier this year when they announced Roo. My impression (and that of my colleague who was there) was that Roo was good if you were generating a web-based CRUD application every few weeks - they pitched it as the pure Java version of Grails (which is RoR for Java).
Didn't look interesting for anyone else - but that's just an opinion.
I've seen a demo of Roo a few months ago. It looks a lot like Grails (another spring technology), except that instead of creating artifacts for the Groovy language, you create them for Java.
Still it enforces good practice and makes you apply the MVC pattern in a clean way.
Personally, the demo didn't make me change my preferred toolkit (Grails), but that's because I can achieve faster results with Groovy (parsing xml for example is much more "painful" in Java than in Groovy). Also, with Grails I can see the changes I make instantly without having to recompile my entire project and relaunch the application each time I want to see the results.
Last but not least, in Grails you have tons of plugins to make fancy Ajax websites (ZK for example, if you want to avoid Javascript, but there are plugins for GWT, Yahoo, Dojo, etc...).
So, if you don't want to learn Groovy (which is not too difficult if you already know Java), Roo is the way to go to build clean web projects with all the power of Hibernate and Spring.
I hope this helps...
Why use Roo when one can build something w/ GWT and end up w/ a far richer better outcome and without the constraints of Roo and its architecture. Spring Web Flow is yesterdays technology.
It completely depends on what your requirements are. If it's a small site then Component Oriented frameworks like GWT or Wicket are a must as they make things really easy.
How soon with Roo support GWT? I think that the use of GWT by Roo makes it a huge win for GWT and Roo!
Roo and GWT are available today in pre-release form. In my opinion, definitely not ready for prime time.

Easiest way to add GWT to a Spring MVC application?

I've got a Spring MVC application and I've decided that I'd like to try using GWT for the front end. I'd like to continue using MVC as I'll also be using Spring Security and some other springy stuff.
I'm aware of the GWT-SL project, and I guess I'll use it. The documentation is light on examples unfortunately.
What I'm wondering now is.... how do I reconfigure my project so that I can use GWT? I'm assuming that I'll lose the ability to run in hosted mode, and I suppose that's ok. Do I just add the GWT and GWT-SL jars, reconfigure my web.xml, and add a package to my project for the GWT code?
I'm using Eclipse 3.4. My existing project is standard web project.
With the new version of the GWT plugin, you'd have all the benefits of the hosted mode browser without having to modify any options. The GWTHandler from the GWT-SL will take care of your rpc call mapping. However, you will have a problem with your existing domain objects structure. You will either have to put them in GWT's 'client' package, or mirror your existing domain objects to enable them to be compiled to javascript. I have been looking for a stable non-invasive framework for doing this, but have yet to find one. Gilead looks promising, but you will have to extend its classes on your domain.
I have posted a view month ago my simple project (3 classes) how to integrate GWT with existing Spring MVC application. Simple sample also provided.
Try it, it is clear and simple: http://code.google.com/p/gspring.
You won't lose hosted mode. I don't know if you're using the internal server for that - I use -noserver so I can't help you there.
Other than that, I guess the documentation is quite clear. Have you hit any specific problems?

Resources