Trying to learn Spring Development but having a lot of problems - java

I have previously posted a question based on spring. It had to do with what IDE to use. I have since downloaded STS.
I have been trying to learn spring from using this IDE and have tried to use books and tutorials I found online.
So far the book I am reading is SPRING ROO COOKBOOK. But it is not showing me how to start developing in Spring.
I am looking for something to try show from the VERY first step, as in from when I install STS, then start up a spring project and make my first web application which will run successfully.
I am sorry if what I am saying is vague and not clear but I am very very confused and just need a clear tutorial which can show me how to start a spring project in STS and take me step by step until it is successfully deployed.
If anyone can send me a direct link to something like this I would really appreciate it.
Again my apologies if it appears vague what I am asking.

I'm a fan of Eclipse not the full STS because Eclipse does not hold your hand (and I already know eclipse without the STS extensions).
Give this a try:
Get the Spring Framework 3.0.6 with docs.
Start reading the reference (it's in the docs directory when you unpack). In chapter 3 they start with the basics.
Create a java project with a main().
create a basic spring-config.xml file, put it in your project at the top of your src tree. basic == 1 simple bean to start, add as you read through the chapter.
Begin testing with getBean() and System.out.println().
Add more to this project as you read through the reference.

STS is one specific tool; you don't need it to work with Spring. While it can be helpful, you should understand what is going on without it.
All the documentation you need is on the Spring website. In addition, I found a sample application in those pages found here.
It's not very difficult to get up an running. You need to download the jar(s), put them on your classpath, create your configurations, which reference the code you write (your components/beans), and do some general config, and you are set. Look over the link I posted, it walks you thru the basic configurations and code.
If you run into any trouble, post a specific question on your issue.

First of all I have to say, I love STS (I must write it because of the other answers :-) )
I know two good sources of Spring Understanding next to the Reference:
Book: Spring In Action
If you have a bit understanding of Spring, then you can also have a look at the Tutorials contained in STS!! itself: Dashbord/Tutorials/ (#everybody else that never have seen this: feature, have a look at it, it is a great way to use Mylyn for tutorials!)
But believe me learning Spring in all details takes several years. So the important thing is to understand the base concepts, and learn to read the spring source code.

Related

Setup a website using Java with Database access

I am trying to learn and better understand the process for communicating java with web content.
Currently I have a finished java project that communicates with a database. I also have a website template I have created purely from hard coded html and css. My next goal is to take my java project to a higher level and incorporate my project with my website.
I have no idea where to start and have little to no knowledge on jsp's or xml files. Others have told me to implement a Spring MVC framework. If anyone can share there input it would be greatly appreciated.
Yes If you already know Java I would definitely advise you to go with Spring and Hibernate. I would always recommend the beginner guide to Spring which is this one Spring MVC: Beginner's GuideJun by G, Amuthan it will show you step by step guide on how to step up your environment. Googling yes you can but don't be overwhelmed with too many resources being out there....For the front page you will have many options Spring allows you to add different dependencies on pom.xml file if you want to use. I have worked with both JSP and Thymeleaf. I would say go with Thymeleaf ... may be I am biased.
Good Luck!

Spring Tool Suite - Hello World

I am following this tutorial: http://www.tutorialspoint.com/spring/spring_hello_world_example.htm
I am using the spring tool suite (STS) that is basically Eclipse. On Step 2 spring libraries and Apache common logging libraries need to be added. Does anyone know how to do this with STS? It seems like these .jars would already be in the tool somewhere...
Every single beginner tutorial does not make near as much sense to me as this one. I am not concerned with MVC or anything like that for instance.
Thank-you for reading. I look forward to any help given.
It should be configured in maven file or downloaded from this website one after another.
If you have sts and if you are not particulary focused on that tutorial you can create a new project by choosing from a list of template project.
There are simple examples for different conceptual facilities of the spring framework
Try this..this has all the things that you are looking for
http://www.codejava.net/frameworks/spring/spring-mvc-beginner-tutorial-with-spring-tool-suite-ide

Creating WebApplication with Database Access in Java

I have to create a simple WebApplication with Java which shows a Login Dialog and after it shows some textfields, gets some Data out of a Database (Sybase) do something with it and insert a new record to the database. Now I am looking for a good tutorial, which explains me, how to setup the needed environment and shows me the start for creating a WebApplication with Java. Can anyone give me some good links to such tutorials? - Many Thanks.
1- BalusC blog - more JSF focused but has every thing . Does not use Spring.
2- Appfuse great starter application plus tutorials uses spring.
3- LULU - Interestingly does not have community presence or atleast not with same name.Uses Spring
4- Java Passion - But not free but very well worth it. I have been member since it was free and now pay annual subscription every year.Not based on spring but does have spring for those who are interested.
5- Spring Roo this is youtube link but you can google as well popular but not my personal choice.
6- Jboss - This is tips link which has further links.Does not use spring and wish they will all die (pun intended and hope not)
7- Netbeans No spring and probably best for any starter
I can go on and on but this should be enough . Also I have a feeling that this question might be closed as soon as people in North-Western Hemisphere wake up :)
If you want to look at using Spring (which seems very popular these days) maybe you should check out this question:
Getting started with Spring 3 Web MVC - Setting everything up
Play framework is what you need. It provides the simplest way to create a web application. Starting with hello world application you'll find another manuals and samples that will help you to achieve your goals.

Spring Jersey Web App - Configuration

I need some help here after a few days of trying to learn spring I have given up trying to find a decent resource.
I am making a Web Application and this is my first full application and I want to use Jersey to make it and also use Spring . I am Using eclipse IDE and Maven as a build tool.
With these settings how is the best way to set up such a web application. Ie the application context ect also do i need to configure some sort of container to run the application on the server as with working with some examples they run fine locally but not on deployment.
If anyone has any tutorials that they have used or infact any resources they are greatly appreciated, Ideally want to have an application set up that uses simpleJDBCtemplate and i can then just code my backend implementation into it.
Help!
Thanks
Chris
I found that the source code given at http://gitorious.org/java-rest-example was very helpful in getting a Jersey app up and running quickly. It uses Jetty, which I've found to be a fast, lightweight web app container. That example doesn't use Spring, but for a basic REST application, you might not need it.
As for a Spring resource, I bought the book Spring Recipes: A Problem-Solution Approach
and found it helpful for explaining Spring from the ground up. One thing I liked about it is it shows you the simple/naive ways of achieving something followed by more sophisticated/cleaner ways of doing things.

RESTful application on Google App Engine Java?

I would like to create a RESTful app on Google App Engine. I would like to provide XML and JSON services. I have briefly experimented with Restlet, Resteasy, and Jersey. I haven't had much success with any of them, other than some simple examples in Restlet.
Could you share your experiences creating a Restful web application on Google App Engine using Java or provide any insight on the aforementioned toolkits on GAE?
Thanks!
Edit (2009-07-25):
I have decided to use Restlet for the time being. It seems to work flawlessly so far. Please post any other insights/opinions you may have. What problems have you encountered? Have you successfully used Jersey/Restlet/Resteasy on GAE/J? If so, we want to hear about it!
I'm happy to report that Restlet M3 works FLAWLESSLY on AppEngine 1.2.2. I have followed the "First steps" and "First resource" tutorials found http://restlet.com/technical-resources/restlet-framework/guide.
So, it seems to me that Restlet is the answer for your GAE/J Restful applications.
I'm using Jersey on GAE. Here is the link for those who are interested about setting it up: (I'm using GAE SDK v1.4.0):
http://tugdualgrall.blogspot.com/2010/02/create-and-deploy-jax-rs-rest-service.html
I am going to begin exploring this as well, but haven't started yet. I did find this framework, that says it should work, but like I said haven't tried it yet.
http://wiki.restlet.org/docs_1.2/13-restlet/275-restlet/252-restlet.html
If you get it working, or manage to get one of the above suggestions working, update everyone as I am sure there is interest in this.
I'm using Restlet together with Guice on Google AppEngine. IMHO they fit together very well. See my recent blog post for further details: http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html
Since these valiant older solutions were patched together, Google has apparently supplied an Eclipse plugin to create a starter project that produces an App Engine app, an Android APK, and a Web app, all talking to one another over an interface defined by a single set of annotated object declarations.
Haven't tried this yet myself, but do have a look before trying any of the more heterogeneous examples described in the earlier messages above:
https://developers.google.com/eclipse/docs/appengine_connected_android
This Google video is also quite informative:
http://www.youtube.com/watch?v=NU_wNR_UUn4
For what it's worth, there has been quite a bit of discussion on Jersey user lists wrt how to make Jersey work on GAE. It is bit tedious work due to GAE restrictions (missing classes from white lists -- hopefully resolved over time), but apparently can be made to work.
So while not trivially easy, that might be your best bet; esp. since many of the problems faced are the same for all frameworks (imposed by GAE).
Well, I would highly advice you to have a look at play framework
Have a look at the video on the homepage
It has a gae module
With siena as a orm to handle gae datastore
From all the java frameworks I've seen so far, I think it has the easier learning curve,
great documentation,
a tutorial to develop a complete application
very active and helpfull community,
free as in beer and also as in speech
highly scalable due to it's stateless out of the box design
rest friendly
highly customizable via it's modules and plugin approach
more over, taking into account it's for a college course, it's really easy to hack into the code, I could handle a couple of tickets and new features without any experience at all with java, just a couple of year developing web applications with php
other benefits
it's really easy to start, no complicated setup involved, just download and unzip the file and your are ready
great development experience, just fix the code and hit refresh, play autocompiles changes on the fly when running on development mode
fast and lightweight
fullstack, you don't have to integrate cumbersome frameworks to make it work
great errors report, no more endless error stack trace, just shows you the line with error
no xml configuration anywhere around
great support for tdd with selenium integrated test
I think the main advantage as a learning tool, is that it's possible to peek into the source code without feeling lost and the community support... The documentation is very clear, and you can learn a lot by just having a look at the source code...
I recently put together a project template with Jersey, Guice and AppEngine at GitHub. It has been developed with SimpleDS, but it can be modified to work with Objectify / JDO easily. The project is live here.
It should be a good starting point for new projects.
Here is a very very good tutorial Restlet/Android/GAE/Objectify with an example of a simple application. Sorry it's in french, but you can juste copy/paste the code, or use google traduction.
I followed it and had a working Android / GAE server communicating together in a 2 hours. It's a good base to start or test Restlet.
http://www.tutos-android.com/webservice-rest-android-appengine-restlet-objectify
Good Luck
The 2 most cumbersome GAE REST API actions to make work, whether Java or .py, are graphics and how to undisplay private information. My little gae rest feed forked another project. I'm sure Java succeeds where python stuck due to the Java takes and gives more ways (advantages) as well as longer (slower) time to succeed (disadvantage) while python projects opens less ways to succeed (disadvantageous) and less development time (advantageous rapid development) to succeed the same.

Categories

Resources