Java EE 7: What’s New?
Join the DZone community and get the full member experience.Join For Free
i am a little 'late to the party' so to say... as far as 'blogging' about java ee 7 is concerned. it has almost been 10 odd months since it was released back in june 2013 , but it is still relatively new. personally speaking, i am thrilled about it, simply because of the ease-of-use and the gamut of features it has bought in. but does it really matter whether i am excited or not ? lol.... it's not just me, but the entire java community (well, almost!) is counting on java ee 7 to usher us into the next generation of rich enterprise software development. after having 'played around' with it for some time now, i think it's high time i started writing about it.
java ee 7 (jsr 342) is in itself an 'umbrella' specification which encompasses 33 individual specifications. i will provide a brief peek into few of these specifications with a special focus on the 'new' specifications and the ones which have undergone 'significant' overhaul and changes.
this post is not a 'deep dive' into each and every specification. i am going to ' introduce ' the brand new specifications introduced in java ee 7.
let's begin . . . . . . . . .
java ee 7: key drivers and usp
- annotated pojos , which have proven to be the cornerstone of ease-of-development paradigm since java ee 5, continue to rule the roost and further penetrate java ee
- contexts and dependency injection (cdi) reputation of being the 'magic glue' has been taken to the next level - it's now 'default' in java ee 7 and its goal is to drive cohesiveness throughout the entire ee platform
- jms 2.0 (jsr 343) has been completely ' revamped '. a 'new version' of the api known as the ' simplified api ' is more succinct, easy-to-use and will ensure that developers have to deal with 'significantly lesser ' amounts of ' boilerplate ' code
- jax-rs 2.0 (jsr 339) - the resftful api in java ee 7 has been further enriched, including addition of a brand new 'client' side api, asynchronous capabilities, servlet filters and interceptors
- java api for websocket (jsr 356) provides a 'easy-to-use' and powerful 'high level' abstraction for developers to write low latency, real-time and feature rich websocket driven applications
- json support - the java api for json processing (jsr 353) has finally 'standardized' json processing. no more 'third party' libraries required for dealing with json.
fulfilling enterprise demands
- concurrency utilities (jsr 236) api now makes it possible to fire your own threads in java ee 7 (forbidden prior to this) in a controlled/managed fashion
- batch applications for java platform (jsr 352) - brand new specification in java ee 7, providing standard way to write efficient ' batch processing ' applications
the ' brand new ' specifications which were introduced in java ee 7 are
- java websocket api 1.0 (jsr 356)
- java api for json processing 1.0 (jsr 353)
- concurrency utilities 1.0 (jsr 236)
- batch applications for java platform 1.0 (jsr 352)
java websocket api 1.0 (jsr 356)
- built on top of the websocket protocol which is an ietf standard ( rfc 6455 )
- websockets allow full-duplex , bi-directional communication b/w client and server over a single tcp connection
- client can send a message to server at any point after the connection is established
- server can send messages to its connected clients/peers without any 'explicit request' from them i.e. totally independent of the client
- the websocket api in java ee 7 supports ease-of-development by allowing support for intuitive annotations which transform simple pojos into server or client web socket end points. the framework also supports 'programmatic' endpoints which works on the basis of
- capability to intercept websocket lifecycle events with the help of annotations
- support for text and binary messages along with health check (ping-pong) messages
the java api for json processing (jsr 353)
- provides a ' standard ' way to parse and generate data in json format
- developers are not 'required' to use third party json libraries (jackson etc), however, they can choose to 'plugin' an implementation of their choice if need be
- modeled on similar lines to the jaxp api and has support for streaming api and dom api
- as the name suggests, the streaming api helps process/generate json in a streaming fashion (similar to the stax api from jaxp). it is a low level api which works on the ' events ' obtained from the json data stream
- the dom api , creates an in-memory java object model for the json data (similar to the xml dom api). it's a easy to use high level api
- support for a ' binding ' api ( json-b similar to jaxb) is in progress and should be 'standardized' in java ee 8
batch applications for the java platform (jsr 352)
- suitable for execution of 'long running' bulk jobs which do not require human intervention and can be scheduled as per requirement e.g. etl jobs, end of day jobs etc
- provides a complete programming model for 'batch' oriented applications
- defines a job specification language which is the basis for defining 'jobs' within an xml. this job xml captures the entire batch process.
- supports two contrasting 'processing' mechanisms.
- chunk style processing involves, 'reading' the input 'bulk' data, 'processing' it and finally 'writing' it as the final step in the process. all these operations are abstracted through specific interfaces, namely, itemreader, itemprocessor and itemwriter
- a ' batchlet ' style processing model is also supported by this api which defines' tasks' which once completed, mark the end of the job
concurrency utilities for java ee (jsr 236)
- earlier editions of java ee forbid initiating application specific threads using the java se concurrency api.
- the new specification provides a standard way to support custom 'concurrency' constructs from within applications.
- leverages/extends the java se concurrency utilities and provides ' managed ' versions of these apis
- now, developers can create threads in a ' managed ' and 'controlled' manner using the javax.enterprise.concurrent.managedthreadfactory
- javax.enterprise.concurrent.managedexecutorservice can be leveraged to fire tasks in an ' asynchronous ' fashion
- this api also allows developers to schedule periodic tasks via the javax.enterprise.concurrent.managedscheduledexecutorservice
that was it as far as the 'fresh' specifications are concerned. here is the revamped specification list
- java message service api 2.0 (major revamp for the first time in 10 years)
- jax-rs 2.0 (restful api)
- enterprise javabeans 3.2
- java persistence api 2.1
- contexts and dependency injection 1.1
- javaserver faces 2.2
- java servlet 3,1
- interceptors 1.2
- bean validation 1.1
the changes/enhancements to these specifications will be covered in a later post . i will also be taking up coverage on the ' individual ' specifications in my future posts.
i hope this gives you another reason to stay tuned ;-)
the only true wisdom is in knowing you know nothing.
Opinions expressed by DZone contributors are their own.