Skip to main content

Java8: How to implement a custom Collector?

Posted by kocko on December 19, 2014 at 4:40 AM PST

As you may already know, Java's Stream API is one of the most significant features introduced in the latest platform version. Aside from the lambdas, which can reduce the amount of boilerplate code in our code base, the Stream API releases us from the burden to be responsible for how collections are traversed, for example.

JavaEE Tip #6 - Resources

Posted by mriem on December 18, 2014 at 9:15 AM PST

The @Resources annotation makes it possible to define resources that you are going to lookup at runtime. The example describes a way to lookup a datasource that is mentioned in the @Resources annotation on the class.


@Resources(value={
@Resource(name="ShoppingCartDB", type=javax.sql.DataSource),

MongoDB: Text search vs. dedicated text search engines

Posted by manning_pubs on December 17, 2014 at 5:47 PM PST

By Kyle Banker, Peter Bakkum, Shaun Verch, Douglas Garrett, and Tim Hawkins
MongoDB in Action, Second Edition

Save 39% on MongoDB in Action, Second Edition discount code jnmongdbat manning.com.

JavaEE Tip #5 - Resource

Posted by mriem on December 15, 2014 at 4:57 AM PST

With the @Resource annotation you define the resource you want to inject. Note this annotation is an older style annotation. Going forward the recommendation is to use the CDI @Inject annotation.

In code

  @Resource
  UserTransaction utx;

Enjoy!

Working with geospatial data

Posted by manning_pubs on December 14, 2014 at 6:17 AM PST

By Radu Gheorghe and Matthew Lee Hinman, Elasticsearch in Action

JavaEE Tip #4 - PreDestroy

Posted by mriem on December 13, 2014 at 7:29 AM PST

With the @PreDestroy annotation you annotate a single method in your class that you want to be called just before your object (EJB, JSF managed bean, CDI bean) is taken out of service.

In code

  @PreDestroy
  public void destroy() {
    // put your destroy code here.
  }

Enjoy!

JavaEE Tip #3 - PostConstruct

Posted by mriem on December 12, 2014 at 6:40 AM PST

The @PostConstruct annotation makes it possible to run initialization code just before something (EJB, JSF managed bean, CDI bean) is put into service.

In code

  @PostConstruct
  public void init() {
    // put your initialization code here.
  }

Managing Marketing Campaigns with Magnolia CMS

Posted by rah003 on December 10, 2014 at 6:46 AM PST

To change up this blog's format a bit, I'm presenting to you: a video blog post! It's only a couple minutes long and shows you how you can manage your marketing campaigns efficiently with Magnolia. Marketing campaigns take a lot of planning and collaboration, and they're typically made up of a lot of different types of content.

SBT: Why a build tool? + 39% savings

Posted by manning_pubs on December 6, 2014 at 10:44 PM PST

By Joshua Suereth and Matthew Farwell, SBT in Action

Save 39% on SBT in Action with discount code sbtjn14 at manning.com.

Git and the Distributed Repository System

Posted by manning_pubs on December 4, 2014 at 5:15 AM PST

By Rick Umali, Learn Git in a Month of Lunches

Save 40% on Learn Git in a Month of Lunches with discount code lgitjn14 at manning.com.