Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Mastering Java EE Development with WildFly
Mastering Java EE Development with WildFly

Mastering Java EE Development with WildFly: Create Enterprise-grade Java applications with WildFly

Arrow left icon
Profile Icon Stancapiano
Arrow right icon
Free Trial
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.3 (3 Ratings)
Paperback Jun 2017 468 pages 1st Edition
eBook
S$41.98 S$59.99
Paperback
S$74.99
Subscription
Free Trial
Arrow left icon
Profile Icon Stancapiano
Arrow right icon
Free Trial
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.3 (3 Ratings)
Paperback Jun 2017 468 pages 1st Edition
eBook
S$41.98 S$59.99
Paperback
S$74.99
Subscription
Free Trial
eBook
S$41.98 S$59.99
Paperback
S$74.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Mastering Java EE Development with WildFly

Working with Dependency Injection

Dependency injection is a very important design principle for working simply and at the same time with major security. It lets us write a very simple code to test. Java uses this principle since Java EE 5 through the CDI specifications.

The first Java frameworks to host this technology were the following:

  • Seam: Firstly, it was a set of utilities to work better with web applications. Next, it was discontinued and integrated in the Java EE 5 specifications; now it represents the main standard that a developer must use.
  • Spring: This was the first Java dependency injection framework born exclusively for complex Java applications. Now it is an evolved set of plugins where you can build anything through dependency injection. It remains an alternative to Java EE.

Contexts and Dependency Injection (CDI) is a set of annotations and services that make...

Dependency injection 1.0 for Java

This specification is provided by the javax.inject API. This is a set of packages specifying a means of getting objects in such a way as to achieve major reusability, testability, and maintainability compared to traditional approaches such as constructors, factories, and service locators. This process, known as dependency injection, is beneficial to most non-trivial applications.

With CDI, you don't instantiate the classes. CDI takes care of it. An internal management of the instances lets the developer create better features for the application. Instances are a point of work where we resolve performance problems. All this becomes simpler using a CDI engine.

Take, for example, a book service:

class BookService {
final List<Book> books;
BookService () {
books = new ArrayList(...);
}
}

Using the new construct, we are adding...

Context and dependency injection 1.1 for Java

This includes advanced SPI interfaces and annotations for CDI development.

Injection and contexts

When we inject a bean, we participate in a context. The context is declared in the CDI specifications as an environment based on the scope. The scope represents how the instances are registered and the type of visibility. If a bean is part of a context representing a session, it will work only in the session. If the same bean is called outside of its context, that bean excluding memory errors could become a part of another context. All instances inside a context are called contextual instances. A bean and a resource are contextual instances.

...

Interceptors 1.2

This contains annotations and interfaces for defining interceptor methods and interceptor classes and for binding interceptor classes to target classes.

Interceptor classes

An interceptor class is a class that establishes a set of operations to carry out when a bean is invoked. It is marked with @Interceptor:

@Interceptor
public class AuditInterceptor {
...}

Or through the beans.xml file:

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="none">
<interceptors>
<class...

Common annotations for the Java platform 1.2

In common annotations, there are three feature sets.

Common annotation

Provided by the javax.annotation package, it is the basis of dependency injection. ManagedBean is the base used to make a POJO an injected object. By default, we don’t need to use it because the CDI engine 1.2 automatically makes this annotation to the POJO. So, automatically each bean is injectable. The @priority annotation was added in this new specification. The @Generated annotation is very useful to mark autogenerated codes, so you can treat them in a different manner. Here is a sample of PostConstruct:

@PostConstruct
public void reset() {
this.minimum = 0;
}

It will be executed after the creation...

Web console for monitoring beans

WildFly 10 provides a tool to monitor CDI instances as interceptors, decorators, beans, and observer methods. This console is provided by Weld probe 2.3.5.

Weld probe provides the option for to any application to use an additional web console to monitor all CDI components of the web app.

Our example offers a complete web application where you can monitor all the components seen in this chapter.

Web applications will be seen in detail in Chapter 14, Writing a JSF Application. At the moment, just remember that in any web application, if you want to activate the weld console, add this script in your web.xml file:

 <context-param>
<param-name>org.jboss.weld.development</param-name>
<param-value>true</param-value>
</context-param>

Always remember that you usually need a beans.xml to start the CDI container.

To use...

Summary

Now we know, in some depth, about the injections of the Java components and how to use them in WildFly. All Java enterprise components work with CDI to be injected or built. CDI Implementations are a good standalone framework, but they also provide a base to work with the other Java enterprise components. This chapter has introduced you to components that we will see in all of the following chapters. We are now ready for the next chapter, where we will see the Java persistence.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Master Java EE development with the latest WildFly 10 application server.
  • Integrate with JSF and JMS and use efficient load balancing techniques to create real-time apps
  • Integrate your backend JavaScript code seamlessly into Java applications

Description

Packed with rich assets and APIs, Wildfly 10 allows you to create state-of-the-art Java applications. This book will help you take your understanding of Java EE to the next level by creating distributed Java applications using Wildfly. The book begins by showing how to get started with a native installation of WildFly and it ends with a cloud installation. After setting up the development environment, you will implement and work with different WildFly features, such as implementing JavaServer Pages. You will also learn how you can use clustering so that your apps can handle a high volume of data traffic. You will also work with enterprise JavaBeans, solve issues related to failover, and implement Java Message Service integration. Moving ahead, you will be working with Java Naming and Directory Interface, Java Transaction API, and use ActiveMQ for message relay and message querying. This book will also show you how you can use your existing backend JavaScript code in your application. By the end of the book, you’ll have gained the knowledge to implement the latest Wildfly features in your Java applications.

Who is this book for?

If you are a Java developer with at least basic knowledge of Java EE, then this book is for you. No previous knowledge of WildFly is required.

What you will learn

  • Configure the development environment along with native and cloud installation of WildFly
  • Write a DB schema and the relative entities and how to use the relationships between the entities
  • Analyze with examples all the java annotations to manage the EJB and the configuration to get better performances
  • Write different REST services through the EJB
  • Implement Web sockets 1.0 and know why and when use the web sockets
  • Work with Active MQ and write JMS clients to manage the authentication and authorization in the clients
  • Configure the mail server through the wildfly console
  • Learn how and when to use a new feature JAX-RS 2.0, which is the asynchronous call through REST
  • Use the new JSF features of Wildfly 10 such as Mojarra 2.2, JSF 2.2, Richfaces 4.5

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 20, 2017
Length: 468 pages
Edition : 1st
Language : English
ISBN-13 : 9781787287174
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jun 20, 2017
Length: 468 pages
Edition : 1st
Language : English
ISBN-13 : 9781787287174
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total S$ 224.97
Mastering Java EE Development with WildFly
S$74.99
Architecting Modern Java EE Applications
S$74.99
Java EE 8 Application Development
S$74.99
Total S$ 224.97 Stars icon

Table of Contents

19 Chapters
Introducing Java EE and Configuring the Development Environment Chevron down icon Chevron up icon
Working with Dependency Injection Chevron down icon Chevron up icon
Persistence Chevron down icon Chevron up icon
Implementing Business Logic Chevron down icon Chevron up icon
Working with Distributed Transactions Chevron down icon Chevron up icon
Creating REST Services Chevron down icon Chevron up icon
Implementing WebSockets Chevron down icon Chevron up icon
Working with Messaging Chevron down icon Chevron up icon
Implementing a Mail Client Chevron down icon Chevron up icon
Asynchronous REST Chevron down icon Chevron up icon
Asynchronous EJB Chevron down icon Chevron up icon
Batches and Workflows Chevron down icon Chevron up icon
Working with Servlets and JSP Chevron down icon Chevron up icon
Writing a JSF Application Chevron down icon Chevron up icon
Sharing the Web Sessions Chevron down icon Chevron up icon
WildFly in Cloud Chevron down icon Chevron up icon
Share your Data Chevron down icon Chevron up icon
Deployment Chevron down icon Chevron up icon
Working with OSGi Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.3
(3 Ratings)
5 star 33.3%
4 star 0%
3 star 0%
2 star 0%
1 star 66.7%
David Sep 28, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is a very good source of informations on the the most recent JavaEE and Web technologies.The author, using a clear and effective language, starts with the basics and then gradually moves to the advanced topics, covering most of the technologies included in Wildfly.
Amazon Verified review Amazon
Salvatore Apr 08, 2018
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Devo dire che non mi è piaciuto per niente.E' scritto male (a livello semantico molte frasi non si capiscono), e gli argomenti vengono trattati in maniera molto superficiale e blanda.Altra cosa negativa è che gli esempi di codice non hanno un minimo senso, non sono esempi di utlizzo reale. Questa cosa è veramente negativa perchè non ti fa capire il perchè devo usare una determinata feature.Bocciato.
Amazon Verified review Amazon
Gaurav Srivastva Oct 14, 2017
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This book is a joke if you bought it to learn. It briefly touches on topics with no depth.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.