Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
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

eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
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
Estimated delivery fee Deliver to Sweden

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Estimated delivery fee Deliver to Sweden

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

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
€18.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
€189.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 €5 each
Feature tick icon Exclusive print discounts
€264.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 €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 125.97
Java EE 8 Application Development
€41.99
Architecting Modern Java EE Applications
€41.99
Mastering Java EE Development with WildFly
€41.99
Total 125.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%
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
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
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela