Spring Jersey Web App - Configuration - java

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.

Related

Spring-WS project creation

I'm trying to develop a simple starter project on Spring-WS using STS 3.9.
I'm new to this technology I'm done with theoretical concepts of web services and Spring-WS.
I have also gone through the spring.io official website for project creation but things over there were not very clear to me.
Can anyone please share some links that shows step by step development of project creation.
Also i also want to know apart from STS spring framework jars what all jars file are required for the same project.
I would highly recommend to take a look at the guides at https://spring.io/guides/. They provide simple-to-follow guides for a wide variety of topics around Spring, including web services. Not sure exactly what kind of web service you are looking for (RESTful or SOAP, whereas RESTful services are the preferred way nowadays), but you will find guides for both.
In case you found a guide that helps you, you can import the guides directly into a workspace in STS via the "Import Spring Getting Started Content" wizard, which you can find via the "New -> Other" and search for "Spring".

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!

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.

Is it possible to reference a Java app from a Grails app?

We have a Java/Spring/Hibernate codebase which is the core to our pretty large platform. We also have quite a few separate Java webapps (Struts or Spring MVC) running alongside which reference the core system, pulling in the applicationContext and services from it.
We have a requirement to build another webapp that also references the same core system, so I was hoping to do this with Grails. From what I've found it appears you can easily jar up legacy Java code, place it in your Grails project lib directory and reference it that way.
http://www.itexto.net/devkico/?p=333
Unfortunately this will not work for me as I need to reference the running core system and its services from my Grails app, as you would reference a Java app from another Java app. Is there any way to do this or is it just not possible with Grails?
Any information would really help...
Thanks,
Justin.
I would look into building a Service Layer on top of your Spring services/beans. This is a pattern documented in Martin Fowler's Patterns of Enterprise Application Architecture book. Essentially you want a thin layer that wraps your Spring services (your business logic) that can be called by a web service or a remote call of some sort from your web-apps. This will allow you to host your applications in different processes but still be able to communicate between them without trying to hack everything into the same web container and figure out how to reference the same running processes.
See documentation on Grails+Spring integration. When you have gotten Spring working inside Grails, next steps should already be standard Spring.
As you have not detailed, how your existing Struts and Spring MVC applications "pull in applicationContext and services" I cannot comment on the details. However, it should be similar to the way your existing applications do it.
EDIT: check also answers to this question on how to organize your Spring beans.

How to implement web services in java

I'm actually working on a website project. I'm new with web services. I have 4 years experience in object oriented programming (java, c#, ...). I have read a lot on web services but none of my documentations are telling how to use all the technologies to make a real web service project.
What I want to do is:
1. Use a MySQL backend mapped with JPA in Java;
2. Use web services to present some functionalities with ... (JBoss, ... there is to much possibilities, I do not know which I should choose)
3. Create a dynamic web project (maybe in Jsp to keep the Java perspective) to present web service data to the end-user with HTML, Javascript, jQuery, ...
If you can help me with documentations, links or real project implementation samples, it will be greatly appriciated.
Thanks
Check this. for beginner
I would suggest go for Spring Web Services from your env. It would be better
I have found something interesting using spring web services with eclipse that I will use with my project at this link:
Sprint Web service tutorial with Eclipse
Likewise, here's a NetBeans tutorial: Getting Started with JAX-WS Web Services

Categories

Resources