How to get started with Server Side - Java - Spring Framework - spring

I'm very new to server side programming, and I want to develop something by using java and Spring framework. I'm working in Android technology for the last two years and I'm very much familiar with Java and Eclipse IDE.
Can anyone provide me links to some useful tutorials and examples?
Which IDE will be more suitable for me? Eclipse or Netbeans?
Thanks in advance...

I think Eclipse is more suitable, Because you already know about Eclipse(Eclipse is used for android projects).
http://static.springsource.org/spring/docs/3.0.0.RELEASE/spring-framework-reference/html
http://static.springsource.org/docs/Spring-MVC-step-by-step/

It's a very vague question but I'll give you my opinion:
Learn Java EE - this includes:
JSP/JSF
Servlets
Web
EJB 3
Build an application using these technologies and only after you familiarize yourself with it, only then start using spring. Spring is using a lot of theses technologies behind the scenes and it is important to understand what is going on
Regarding eclipse vs netbeans - I'm a huge fan of eclipse and i think it is a great tool however netbeans has better integration with Glassfish (sun/oracle application server) and better GUI tools. so it is really a matter of taste.
As for web/application servers:
Tomcat is a great server to start with, but since it is a web server it does not support EJB.
For using EJB you'll need an application server like Jboss or glassfish.
I'd start with tomcat and then move to glassfish.

What IDEs are you used to? I recommend that you use STS - Spring Tool Suite, which is an Eclipse based IDE maintained by SpringSource. Alternatively, the IntelliJ IDEA Ultimate also provide good support for Spring projects.

Related

What's the best way to create a Java EE project (maven+git) using Spring tool suite?

I see that there are many kinds of project you can create with Spring Tool Suite.
I'm wondering what's the best choice if I should create a Java Enterprise Edition project, integrated with maven and git.
Is there a specific project to select, in order to have straight away all the environment ready?
From the Spring perspective, I would strongly recommend to start with a Spring Boot project and go from there, using the new Spring Tools 4 (or the Spring Tool Suite version 4). It provides wizards to get started quite easily.
If you don't want to use Spring Boot, but something else from the Java Enterprise Edition standard in combination with Spring, I would recommend to use the Spring Tools 3 distribution (comes with the full Java EE tooling from Eclipse pre-installed) or install the necessary parts from Eclipse into a Spring Tools 4 installation. Which parts you need highly depends on which parts of the Java Enterprise Edition spec you would like to use - the general term "Java Enterprise Edition" is very broad and it is hard to give any advice without knowing which parts you would like to use or what you would like to accomplish.

How do I implement dynamic reloading in Spring (Netbeans)?

I'm used to writing Grails applications where my view or controller changes are automatically redeployed on save. I'm now stringing together a Spring Web-
MVC application and I'd like the same feature.
I'm using Netbeans as an IDE, Gradle as a build tool and the spring-boot plugin at the moment. I remember some talk of people using Jetty as it's so quick to restart that dynamic class reloading / deployment is no longer necessary. I've heard others mention JRebel which I used to use a few years back. I'm sure there is a more modern, spring-supported / spring-standard way of doing it.
I'd also like to know if you recommend deploying as a WAR or as a standalone executable JAR with a lightweight built-in web server.
Recommendations appreciated.
A yet unsolved challenge
It turns out that the Netbeans Gradle plugin does not support "compile on save" out-of-the box - and this means that a Java Agent won't be able to pick up the changes. The author kelemen suggested one or two approaches around this. It's a non-negotiable for me, so I decided to switch IDE's to Eclipse (terrible Gradle support), then IntelliJ Idea - which is looking very promising.
Netbeans Gradle Author Comment: https://github.com/kelemen/netbeans-gradle-project/issues/183
Alternatively, there is Jrebel, which is claimed to be able to support this Netbeans / Gradle combination. I wasn't able to get it working easily using a trial of JRebel. The JRebel support guys are there to help, so if you're willing to pay the price, it's likely that their support team will solve your problems.
JRebel: http://zeroturnaround.com/software/jrebel/
If anything changes, please comment below...
Spring class reloading is supported by HotswapAgent as well. It is free alternative to JRebel.
Spring has their own agent as well: https://github.com/spring-projects/spring-loaded. While developing why not just use embedded Tomcat/Jetty provided by Spring Boot.

How to use Maven, Spring, Hibernate (JPA) on Netbeans or Eclipse

Being extremely very new to Java EE, I am trying to build a rest api with a database layer.
I am using Netbeans 7.2 and Glassfish because they were easy to install on my Mac OSX Lion. From netbeans I open a project with Maven, choosing archetype weby. What I am going for is Maven, Spring, and Hibernate with JPA. Also I am using restlet for my Rest API layer. Anyway, the tutorials I find online, along with the book Spring persistence with Hibernate [electronic resource] / Paul Tepper Fisher and Brian D. Murphy keep refering to /src/main/resources/META-INF/spring/spring-master.xml. But the project has no such folder. Instead the project has the /main/resources/hibernate.cfg.xml and a folder about jdbc connection.
Basically I am stuck. Some questions:
Am I using the correct Maven Archetype? Is there another way to get what I am looking for (using Netbeans or Eclipse on my Mac)?
I don't want to spin around too much, which is why I have not manually added the /src/main/resources/META-INF/spring/spring-master.xml, especially since I am not sure what to put in it.
Others opinions is greatly appreciated.

Hard time on learning Java EE - mostly installing and testing stuff

Its quite a while since I started learning Java EE (I come from Rails world).
I'd like to test create a simple blog to test these:
- Hibernate, JPA
- Spring with MVC
- JSF and routing
- Struts 2
- Eclipse and local test (modify, reload, check changes)
- Tomcat, Jboss or Jetty
- An administration area (Session)
- Maven
I've a basic knowledge of each of those but as soon as I spend tons of time installing stuff and, somehow, I manage to resolve all inconveniences there is ALWAYS something that goes wrong (installation, tutorial obsolete, should I work with Spring IDE, MyEclipse, Jboss Application Server or regular Eclipse?, tons of random errors, each tutorial asking for random dependencies, each showcase).
QUESTION
How do you create quickly a startup project with these components?
You go with some Maven archetype? If so which one?
What I'd like is something I can download or build equipped out of the box with all above mentioned components. To name a few:
- railswizard.org, youvegotrails.com, railsboost.com/templates/new
SIDE QUESTION
Currently I'm following this great series, can you suggest some more like this:
- http://www.youtube.com/user/koushks?feature=gb_p13n_ch_rec
All the above components in a single project? That makes no sense; Spring MVC, Struts 2, and JSF would rarely be combined in the same project.
Each web framework has demo applications, what's wrong with those? There are archetypes for at least some combinations, although I'm not sure it's not better to put them together yourself.
Without knowing what kind of issues/errors you're getting, it's impossible to help. Maven should be taking care of most/all dependency issues. You shouldn't be spending much time installing anything by hand except maybe an app container.
IMO you're better off asking specific, actionable questions, and start with each specific technology and build up an application, rather than trying to integrate everything at once--a sure recipe for frustration.
For starting with a simple Java EE application, a good point to start is just downloading a Java EE 6 implementation.
Those are offered by various parties, which might be confusing at first. It's however just like there isn't the One and Only C compiler, but there are many and they all compile the same standard C.
For Java EE 6, obvious choices are GlassFish 3.1.2, JBoss AS 7.1, TomEE. (just pick one, at this stage it doesn't matter much which one you'll use).
Java EE 6 is a full stack solution. It's a single download and you don't necessarily need to install any other libraries. It comes with an MVC framework (JSF), an ORM solution (JPA), dependency injection (CDI), business logic support (EJB) and then some.
As for the IDE, NetBeans has a particular good default integration for GlassFish (can even be downloaded as one bundle), but for Eclipse it's not that difficult either. You need to download the Java EE edition of Eclipse and after starting it, go to Help -> Eclipse Marketplace, search for "GlassFish" and install the "GlassFish Server Plugin".
See also Minimal 3-tier Java EE app, without any XML config for a very minimal example to get started and JSF 2.0 tutorial with Eclipse and Glassfish for a very detailed one including instructions how to exactly setup the IDE.
What I'd like is something I can download or build equipped out of the box with all above mentioned components. To name a few:
http://appfuse.org/display/APF/Home
Appfuse will take you through the initial setup of a maven built spring based web application with hibernate included.
If you come from the rails world you might also look into Spring Roo which tries to borrow from Ruby i'm told. The primary focus of roo is to stand up all of the technology you've listed above quickly.

Confused about using SpringMVC Vs Java EE project in Netbeans

I want to start a my first Java EE project. I have read a lot that springMVC framework is a good choice (never used though)
My earlier experience with java is not much. only some small app development using Netbeans. so I have some experience using Netbeans.
But I see that I can start a Java EE project in Netbeans. so what kind of framework netbeans is using underneath.
PS: My understanding of framework (e.g. SpringMVC) is that you follow rule of framework to configure your app. and then framework take care or linking your View, controller and model.
so if i am using netbeans, do i need to take care of linking of my MVC by myself?
I see that I can start a Java EE project in Netbeans. so what kind of framework netbeans is using underneath.
Hmm... Nothing. NetBeans is just an IDE and let you use whatever framework you want: JSF 2.0, Wicket, Struts 2, Stripes, Spring MVC, your own poison. Of course, one could say that NetBeans promotes (and supports) JSF 2.0 but this doesn't mean you can't use another framework, just add the required libraries to your project.
In any case, Spring MVC is just one options amongst others and is not an absolute requirement to write Java EE applications. Some Java EE applications don't even have a web interface actually. And believe it or not, you can write Java EE application - especially Java EE 6 applications - without Spring :)

Resources