JEE has not died

Why Spring?

Could you quickly and without hesitation anwer such a question:

Why am I using Spring

Why did people of Java once marked JEE as ugly?  I will tell you. It was during the time when JEE was big, lazy, and noone wanted to use it.  Spring has come with all its beauty – Annotated beans, lot of added value (easy Transactions, easy Data).  Of course during some period it was incomparable. But time is running.  Why do I say that it is easy to run small JavaEE (micro)service and have it in some minutes? Let me tell..

Prerequisities

Application server

Download App server: I recommend Wildfly.  After having a lot of mundane work with Websphere7 in work I felt relief when I could simply start quick Wildfly server and deploy application in seconds. That was something super cool

Java

Use Java8. Get JDK 8. No questions.

Forging tool

Download JBossForge. Of course it is nothing wrong to build it by yourself but: come on! You have your businness programming to be done!

Forge, code it, deploy

forging

Using JBossForge create the app schemat. You just type forge and nice console appears.

[code lang=”text”]
project-new
[/code]

and forge will take your hand and lead into project construction. Choose war please. Voila, maven project created. mvn clean install it and here we go. Now let’s do some coding.

coding

Create config class like that

[code lang=”java”]
@ApplicationPath("/app")
public class ApplicationConfig extends Application {
}
[/code]

and endpoint similar to that

[code lang=”java”]
@Path("/fast")
public class FastEndpoint {

@GET
public String getHelloFromFastJavaEEPath() {
return "fast!";
}

}
[/code]

That’s all folks!

deploying

Start your wildfly, go to the pretty fresh console at http:\\localhost:9990 and go on! Deploy your war.
Tired of deploying manually? Nothing simpier : use maven plugin for that.
Now check it – have your first fast-jave-ee hands-on experience: go to app url. You should see response.

Cloudy?

Nothing easier. After little research I made I see nice options at openshift. They give you 3 gears for free (with idling) or the same number of gears – bronze option, when you’ll provide your credic card data. One gear = one server. Sounds like enough for getting started.

The end

I am using Spring. And I will not stop doing it. But it’s valuable to know that world of JEE is not so scary as it used to be.