How to configure Eclipse RCP with Spring - java

How can I configure eclipse RCP with spring? Do I need spring dm?
Can you please show me a tutorial on how to configure spring with Eclipse RCP or Eclipse RAP?
How can I add spring to Eclipse RCP and just use it? How can I see the context everywhere?
Do I have to add something to my Target Platform?
Is there any tutorial or can you please tell me more details?
I just want to use Spring with my Eclipse RCP application.

Using Spring DM is not the only way, but I believe it's the easiest and most complete/correct way of doing it. Prior to Spring DM, there were several projects with the goal of integrating Spring and Eclipse RCP, but none of them were very simple, or very Spring-like. I have come across a blogger who is currently writing a series of articles on integrating Spring and Eclipse RCP using Spring DM. The first 4 articles cover exactly what you need to know with examples (step 0 through step 3).
The entire list of articles is here:
http://angelozerr.wordpress.com/category/java/spring/spring-dm/
That same blogger talks about his own RCP/RAP project (where he is using Spring DM) in another set of articles. These are in French, but using Google Translate makes them useful for non-French speakers. Take a look at step 7 and step 8 here:
http://angelozerr.wordpress.com/about/dynaresume/

I recently wrote a blog about this topic, you can find step-by-step tutorial here: http://blog.novatec-gmbh.de/step-step-spring-eclipse-rcp-applications/

I think my answer might be helpful to anyone (like me) looking for building Spring DM, OSGI console application.
Although its been quite sometime Since Spring DM has been inherited as Gemini Blueprint, it is recommended to use Gemini Blueprint instead of Spring DM. Nevertheless, Spring DM is also a good starting point.
This tutorial is worth looking at: http://www.jroller.com/dbrosius/entry/osgi_spring_dm_w_o
It provides step by step information
NOTE: There is a small package-name typo in Manifest.MF file that needs to be fixed. Eclipse will flag it so it's a non-issue

Related

Spring Project without annotations in IntelliJ

I am using IntelliJ IDE which by default generates a annotation based SpringApplication when I create a new Project for Spring Application. I want to first learn the concepts of Spring Application without Annotations(XML based). Could anyone give me suggestion for how to set in the IDE such that I get a non-annotation based project by default when I select for New Project.
The current version of Spring is
3.2.0
I created a basic annotation based Spring 3.2.0 app here : https://github.com/ajorpheus/hello-spring/
If you are comfortable with Git/Github, then clone that repository locally and import that project into Intellij using File -> Import Project ( otherwise, you could download the zip of the project itself : https://github.com/ajorpheus/hello-spring/archive/master.zip and then go from there. No git-fu needed.)
This project runs fine in Intellij as a maven project.
I have taken the liberty of also interpreting your question as 'How to learn Spring'. IMHO, here is what helped me when I was starting out with Spring.
First Steps
To start with, for further reading or a bit of experimentation, these seem like a good start :
http://projects.spring.io/spring-framework/#quick-start
http://spring.io/guides/gs/maven/
Books / Resources
I also recall that reading 'Spring In Action - Third Edition' helped when I was starting out with Spring, though I would not recommend buying it now since a much more up-to-date Fourth Edition is on it's way.
A couple of threads here also cover the topic of 'Best Resources for learning Spring' :
Book suggestion for Spring framework
https://stackoverflow.com/questions/1610733/best-way-to-learn-spring-framework
You'll find some books/resources repeatedly being mentioned is threads such as the above. 'Spring Recipes', 'Spring in Action', 'Pro Spring', 'Official Spring Documentation' ... all of these 'spring' to mind :D.
Finally, as far as Spring is concerned, there is no dearth of resources or threads advising about these resources. I'd recommend not spending a lot of time researching where to start. Just a pick a book which has been mentioned in more than one threads and go for it !
Hope this helps !

looking for Vaadin and Spring archetype

I'm starting to develop a new web app application with Vaadin and Spring, but I can't find an maven archetype for this.
Can you give me some assistance?
There is no such archetype. In fact, just to get those two frameworks working together at all, you're either going to need to go all wild-west and do it yourself (what I did) or use a plugin to get it working.
Here's the SpringVaadinIntegration plugin.. It takes an interesting approach to integrating Spring scopes with Vaadin sessions. The sample project for that plugin will be especially helpful for you to look at.
If you want to do it the do-it-yourself way, I can tell you that I divorced my vaadin from my spring as much as possible. Essentially I created some classes with static references to my spring singleton-scoped beans, and used those static methods for accessing my spring beans from Vaadin.

Using Spring (3.0.5) in Eclipse (3.6 Helios)

I just got a book from Apress (Spring Recipes), and I started to learn the Spring framework and now I have a problem. I followed the steps in the book to add the Spring .jar-s to the build path. Everything seems to work fine, but the code I have just doesn't work.
My question is that: do you know about a good tutorial for integrating Spring with Eclipse? I googled for a while and I only found old tutorials (from 2007-2009) which just doesn't work with Eclipse 3.6.
use STS - Spring Tool Suite. It is built-upon Eclipse IDE. http://www.springsource.com/developer/sts
STS helps hugely (you can get it from the Eclipse Marketplace for free). The features of it I particularly like? Here's a few:
As a user of XML-based configuration I love having the bean graph visualized – it's great for reports – but the content assist when filling out bean properties is invaluable, both for names and for values (i.e., it makes writing that much XML not suck too much). I imagine that if you're heavily using autowiring or Java configuration it's less useful.
Refactoring support is also good (these days; it used to have bad bugs so you want to be patched up to date) and I've found that the pointcut search to be the only way to write a complex aspect without lots of round-trip testing.
But not all of STS is perfect. In particular, some of the content assist modes don't (seem to) help (me) that much, and it really only works well if you have your properties defined using public setters. Still, it helps a lot…
Apart from using STS as suggested, you can use spring and eclipse without any integration. There isn't that much an IDE integration can offer anyway (apart from autocompletion in the xml, and linking the xml to classes (inclding aop))

Which m2eclipse archetype to use for JBoss/Hibernate based projects?

I am new to Java world but I am pretty good at using Flex, actionscript 3, Ant and even Maven to some extent. Now I would like to learn some java and use Hibernate and JBoss (webapp).
I already have Maven working and have found the m2eclipse plugin on the web, it seem pretty nice for maven integration.
Now I would like to know how to set the project using "best practices" if possible and start the ball rolling. My question is not about using Java or Hibernate, it is just about project settings / configuration using m2eclipse or maybe another tool if necessary.
Thank you in advance for your help.
Actually, archetypes are not m2eclipse specific, they are maven species. But this was just a side note. Now, to answer your question, there is "sadly" no unique option and I hope I won't make things more confusing at listing them:
You could simply use the maven-archetype-webapp archetype to create a blank webapp and setup the Hibernate stuff yourself (follow the Hibernate tutorial which is maven based).
You could create a more specialized webapp (using the struts2-archetype-starter or the wicket-archetype-quickstart or a MyFaces archetype) and setup the Hibernate stuff yourself.
You could use the javaee5-maven-archetype archetype to create a Java EE 5 (JSF 1.2 + EJB 3) application.
You could use the softeu-archetype-seam archetype to create a JBoss Seam application (JSF+Facelets+Seam).
You could use one of the numerous AppFuse archetypes (Hibernate, Spring and the presentation framework of your choise) to create an "AppFuse" application.
If you want some guidance, my recommendation would be to go for an AppFuse archetype.
Choose a presentation framework and pick up the corresponding archetype. If you want a more "naked" solution, generate a blank webapp and setup hibernate yourself (follow the mentioned tutorial).

Getting started with Spring 3 Web MVC - Setting everything up

I'm trying to get started with JAVA/Eclipse/Spring MVC but can't seem to find a "dummies" or "step-by-step" guide for setting everything up and creating the simplest proof-of-concept application.
I found http://static.springsource.org/docs/...-step-by-step/ but there seem to be differences between Spring 2.5 and Spring 3 so i'm looking for something for Spring 3.
Also, the tutorial for Spring 2.5 focuses on building the application usign Ant - This i will certainly be doing for releasing but when working within Eclipse i want to have set up the project so that i can use breakpoints/debugging and this is not covered at all.
I've downloaded Eclipse, Tomcat and the Spring 3 Framework but that's about it and within the downloaded Spring Framework documentation it states:
2.3 New getting started tutorial
There is now a new getting started tutorial
for developing a basic Spring 3.0 MVC
web application. This tutorial is a
separate document that can be found at
the Spring Documentation page
However, i can't seem to find such a tutorial on the linked page. My main problem at the moment, as seems to be the case for many people trying to get started with Spring, is that i can't seem to get everything set up.
I've got a copy of Expert Spring MVC and Web Flow and i've also found this tutorial but i don't know if the setups they describe are still relevant and whether they will allow debugging.
Can anyone please give some direction?
Thanks
Get the mvc-basic or the petcare sample apps from the Spring Samples SVN repository. These samples have been updated to Spring 3.0 and are directly importable & runnable with SpringSource Tool Suite.
I am also started to learn Spring 3.0 and i am not getting any help means any tutorials. but i find this site http://viralpatel.net/blogs/2010/06/spring-3-mvc-create-hello-world-application-spring-3-mvc.html and its very help full for start up development. but still i am finding another example so that i come to know more about it
if anybody knows some example in spring 3.0 then please provide me.
Thanks
Dhrumil Shah
These days, I think the easiest way to find out how to set up a spring application is by trying out Spring Roo. It may not be what you finally end up using when coding your project but it shows you exactly how to setup a Spring MVC web app.
I've also been looking all over for a full Spring MVC 3.0 tutorial with Eclipse that I could follow and haven't had too much luck in my research. The closest and most helpful example that I could find is here: http://krams915.blogspot.com/2011/01/spring-mvc-3-hibernate-annotations.html. This is also a maven project, but I was able to move some things around in my Dynamic Web Project within Eclipse and at least get the initial page to come up. Currently, I'm having issues with spring finding my controller class, but I think that's a part of changing the configuration files to meet my project needs. But try it and I hope it works for you!
I found these tutorials really helpful:
http://krams915.blogspot.ch/p/tutorials.html
I wanted to use REST and MongoDB and followed following tutorial with success:
http://krams915.blogspot.ch/2012/01/spring-mvc-31-implement-crud-with_4739.html
I hope it helps. I know how you feel :) Had the same issues. But it's worth sticking with Spring and learning it. It's a great framework once you know it.
Personally I made not so good experiences using Spring Roo. It can help you maybe a little bit for investigation how to setup a project but if you are new to Aspect Oriented Development you'll have a hard time figuring out what Spring Roo does. It can help you to setup a project really fast and easy but if you don't understand what's behind the facade it's hard working with it. This is not really for a beginner and no necessity for any project. But Aspect Oriented Development is worth wile learning and can be very useful to avoid boiler plate code.
Another route might be use appfuse, specifically using maven to generate the application template code from the appfuse archetype. E.g. this link.
There is a major difference in Spring 2.5 and Spring 3.x, Spring 3 or later introduces Annotations based bean wiring and dependency injection.
The nice step by step tutorial i found is http://www.journaldev.com/3531/spring-mvc-hibernate-mysql-integration-crud-example-tutorial

Categories