Feed aggregator

The Most Significant Changes To Open Source

Javalobby Syndicated Feed - Mon, 12-Feb-18 01:01

To gather insights on the current and future state of open source software (OSS), we talked to 31 executives. This is nearly double the number we speak to for a research guide and believe this reiterates the popularity of, acceptance of, and demand for OSS.

We began by asking, "What have been the most significant changes to the open source ecosystem in the past year?" Here's what they told us:

Categories: Java

Implementing AOP with Spring Boot and AspectJ

Javalobby Syndicated Feed - Sun, 11-Feb-18 22:01

This guide will help you implement AOP with Spring Boot Starter AOP. We will implement four different advices using AspectJ and also create a custom annotation to track execution time of a method.

You Will Learn

  • What are cross-cutting concerns?
  • How do you implement cross-cutting concerns in an application?
    • If you want to log every request to a web application, what are the options you can think of?
    • If you want to track the performance of every request, what options can you think of?
  • What are Aspects and Pointcuts in AOP?
  • What are the different types of AOP advices?
  • How do you implement AOP with Spring Boot?
  • How can you use Spring AOP and AspectJ to implement your aspects?
  • What are some AOP best practices?

Project Code Structure

The following screenshot shows the structure of the project we will create.Image

Categories: Java

Using JAXB for XML With Java

Javalobby Syndicated Feed - Sat, 10-Feb-18 23:01

Java Architecture for XML Binding (JAXB) is a library that helps bind XML schemas and Java representations. JAXB provides you with a mechanism to marshal Java objects into XML and the other way around – unmarshal XML into Java objects.

XML is an industry standard for defining the contents of your message. XML, along with Java, are complementary technologies to exchange data across the Internet. When you work with XML, you need a way to take an XML file, then convert it into some sort of data structure, which your program can manipulate. You also need to serialize the state of your Java objects into XML. JAXB is one library that performs such marshalling and unmarshalling operations.

Categories: Java

Reactive Streams in Java 9

Javalobby Syndicated Feed - Fri, 09-Feb-18 22:01

The release of Java Development Kit (JDK) 9 in September of last year brought with it many improvements to both the Java Virtual Machine (JVM) and the Java Language Specification (JLS). Foremost among these additions was the inclusion of the JDK Enhancement Proposal (JEP) 261: The Module System (nicknamed Project Jigsaw), which introduced one of the most comprehensive overhauls of the JVM since its creation. Behind all of the fanfare, there were also 85 non-module JEPs contained in the release, including the addition of a Hypertext Transfer Protocol (HTTP) 2 client (JEP 11o), jshell (JEP 222), and important concurrency updates (JEP 266). Within these concurrency updates, a major improvement was made to the Java standard libraries: Reactive Streams.

The Reactive Streams initiative was started in 2013 by some of the most influential web application companies (include Netflix) as a means to standardize the exchange of asynchronous data between software components. As more frameworks and library builders supported this initiative and its specification, various Java implementations of this standard began to appear. Due to the simplicity of the Reactive Stream standard, many of the interfaces that made up these implementations were identical, separated only by their package names. In order to reduce this duplication and importation incompatibility, Java 9 now includes basic interfaces for each of the fundamental Reactive Stream concepts in the Flow Concurrency library. This allows all Java applications to depend on this one library for Reactive Stream interfaces, rather than deciding on a specific implementation.

Categories: Java

Developing Secure Scala Applications With Fortify for Scala [Presentation]

Javalobby Syndicated Feed - Fri, 09-Feb-18 14:01

From banks to airlines to credit rating agencies, security continues to be a major focus for organizations across various industries. As the newspapers show, it’s heavily damaging to enterprises when security vulnerabilities in their code, infrastructure, or open source frameworks/libraries get exploited.

The good news is that your Scala development team now has a powerful ally for securing their applications. Co-developed by the Fortify team along with Lightbend, the upcoming Fortify for Scala Plugin is the only Static Application Security Testing (SAST) solution to use the official Scala compiler. This plugin automatically identifies code-level security vulnerabilities early in the SDLC, so you can confidently and reliably secure your mission-critical Scala-based applications.

Categories: Java

CodeTalk 2.0: Containers, the Java EE Way [Podcast]

Javalobby Syndicated Feed - Fri, 09-Feb-18 08:46


Intro by DZone Content and Community Manager, Michael Tharrington

Welcome to the first episode in DZone's relaunch of our official CodeTalk podcast!

Categories: Java

Building RoaringBitmaps From Streams

Javalobby Syndicated Feed - Fri, 09-Feb-18 04:01

RoaringBitmap is a fast compressed bitset format. In the Java implementation of Roaring, it was, until recently, preferential to build a bitset in one go from sorted data; there were performance penalties of varying magnitudes for incremental or unordered insertions. In a recent pull request, I wanted to improve incremental monotonic insertion so I could build bitmaps from streams, but it sped up unsorted batch creation significantly by accident.

Incremental Ordered Insertion

If you want to build a bitmap, you can do so efficiently with the RoaringBitmap.bitmapOf factory method.

Categories: Java

What Kotlin Fixes in Java

Javalobby Syndicated Feed - Fri, 09-Feb-18 01:01

Kotlin is a statically typed programming language that runs on the JVM and can also be compiled to JavaScript source code as well as use the LLVM compiler infrastructure. Kotlin was originated in 2010 at JetBrains and has been open source since the year 2012.

It is a general purpose open source programming language for the JVM as well as Android and combines the features of both functional and object-oriented programming. One of the main reasons behind Kotlin’s popularity was its perfect compatibility with Java 6. That helped Kotlin make a name for itself as a suitable alternative to Java.

Categories: Java

Java 9 Modules (Part 3): Directives

Javalobby Syndicated Feed - Thu, 08-Feb-18 22:01

In this last post about Java 9 modules, we will take a closer look at some module directives. We will explain what they are and show their usage by means of an example. We will build upon the example used in part 1 and part 2, it is advised to read these posts before continue reading. The sources used in this post are available on GitHub in branch feature/modules-directives.


The requires directive indicates that this module depends on another module. We used this directive in the previous posts, where the module com.mydeveloperplanet.jpmshello depends on module com.mydeveloperplanet.jpmshi.

Categories: Java

Sending SMS Messages Through Slack With Java and Routee

Javalobby Syndicated Feed - Thu, 08-Feb-18 14:01

Using Slack for your communication is easy and reliable. Wouldn’t you like to be able to send SMS too, without having to use your phone?

Follow this simple guide to maximize your Slack account’s potential.

Firstly, you will need:

Categories: Java

Field-Access Interfaces for More Readable Java Stream Code

Javalobby Syndicated Feed - Thu, 08-Feb-18 10:01

Code using Java's Stream API is not very readable. To be fair, that is partially because the Stream API is based on the functional programming paradigm, which most Java programmers are not familiar with.

Another problem, arguably, is the rigidity of the API. Well actually, it is the rigidity of the language. By that, I mean that the strict syntax and the strong typing of Java force us to write code using terminologies that do not make much sense (names like map, flatMap), are verbose and unconcise for lambdas (lack of default variable name like 'it' in Groovy), as well as the generic typing of function types (Function).

Categories: Java

Java 9: Small Language Changes and New APIs [Video]

Javalobby Syndicated Feed - Thu, 08-Feb-18 04:01

When thinking of Java 9, one might immediately think: Project Jigsaw. Or JShell. Or...

But a couple of changes have been made to the core Java language itself, and some new APIs have been introduced. Some changes seem cosmetic, but some are actually a welcome addition to the Java language. So what's new? What can immediately use in your day-to-day work?

Categories: Java

Using Gradle Build Caches With Kotlin

Javalobby Syndicated Feed - Thu, 08-Feb-18 01:01

The build cache works by storing compiled classes, test outputs, and other build artifacts in a cache, taking into account all task inputs, including input file contents, relevant classpaths, and task configuration.

Categories: Java

Integration of Microsoft Visual Studio Team Services, Protractor and Sauce Labs

codecentric Blog - Thu, 08-Feb-18 01:00

Continuous Integration and Automated Testing in combination with cloud testing platforms can prove as a good practice in the web application development life cycle. As a result, these can improve the product reliability and quality. Cloud testing platforms provide a vast number of possible environments to run tests against, execution in parallel to improve efficiency, execution recording and detailed reporting and overall a very comfortable experience for QA teams. Based on an example, this post will explain how to integrate these concepts. The example will use the following technologies: Microsoft Visual Studio Team Services (VSTS), the Protractor end-to-end testing framework, and the Sauce Labs cloud testing platform. The web application in this example is based on Angular and created using Angular CLI.

Protractor configuration

To enable test execution forwarding to Sauce Labs, add the following attributes to exports.config object in protractor.conf.js:

exports.config = {
  sauceUser: /*sauceUser string*/,
  sauceKey: /*sauceKey string*/,

Any specific Sauce Labs options go into the capabilities object inside exports.config.
For example, if there is a need to extend the default Sauce Labs test duration time (30 minutes), then add a property maxDuration with the integer value in seconds.
Also, to enable parallel test execution, add the properties shardTestFiles and maxInstances to capabilities. The property shardTestFiles ensures that tests run in parallel, while maxInstances represents the number of tests running in parallel.

exports.config = {
  capabilities: {
    maxDuration: /*integer value*/,
    shardTestFiles: true,
    maxInstances: /*integer value*/,

To have a test result report generated, add Jasmine JUnit XML Reporter in onPrepare function in protractor.conf.js:

onPrepare: function () {
  jasmine.getEnv().addReporter(new JasmineReporters.JUnitXmlReporter(
      consolidateAll: true,
      savePath: 'e2e/testresults',
      filePrefix: 'testresult-' + Date.now()

The VSTS build definition will use the resulting file of the XML reporter to publish test results.

Microsoft VSTS build definition

Build definition can be created from existing templates or from an empty process with custom tasks.
Microsoft VSTS offers various build definition tasks and tools regarding build, test, package, deploy, utility, etc.
This example will use npm build tasks to run scripts.

The first script is npm install. It will install a project on the build server and fetch dependent npm modules.

Next is a custom script npm run webdriver-update. It will download and install Selenium server and drivers required for end-to-end tests to run.

Next is also a custom script npm run e2e. It actually calls the Angular CLI command ng e2e. This command will serve the application and run end-to-end tests in accordance with the configuration in protractor.conf.js. It is using the Sauce Labs username and key and is forwarding test execution to Sauce Labs.

Therefore, add following two scripts in package.json file:

"scripts": {
  "webdriver-update": "webdriver-manager update",
  "e2e": "ng e2e",

In addition, the build definition should have a task to publish test results. There is a built-in task for this purpose and it requires the test result format and test result file path. This task will use the resulting file from the Jasmine JUnit XML Reporter, so as a test result format choose JUnit and as test result file path input **\testresult*.xml.

Sauce Labs integration plugin

The command npm run e2e requires the Sauce Labs tunnel to be open to forward the test execution to Sauce Labs.

To integrate VSTS and Sauce Labs, install the additional plugin Sauce for Visual Studio Team Services in VSTS. This plugin can be found in the Visual Studio Marketplace.

After installing this plugin in VSTS, two new build definition tasks will be available: Sauce Labs Configuration (Preview) and Sauce Labs Stop Sauce Connect (Preview).
These two tasks provide VSTS with the actions of establishing and closing a tunnel to Sauce Labs, and they should surround the test execution task (npm run e2e) in the build definition.
Furthermore, VSTS requires Sauce Labs credentials in order to establish a tunnel. To do this, add a new Sauce Labs Credentials service endpoint in VSTS. After that, use the newly created Sauce connection in the Sauce Labs Configuration (Preview) build task.

It is good practice to pass the Sauce Labs username and key as build variables. VSTS offers public variables which will be used for Sauce Labs username. VSTS also offers secret variables which are useful for passwords, keys, etc because VSTS encrypts these variables. Sauce Labs key will be set as a secret variable. Build tasks access secret variables through command arguments (for example $(SAUCE_ACCESS_KEY)).
To access public variables in the Protractor configuration, use process.env and for secret variables use process.argv. So in this example it will be:

exports.config = {
  sauceUser: process.env.SAUCE_USERNAME,
  sauceKey: process.argv[3],


Finally, the build definition should contain these tasks:

  • npm install
  • npm run webdriver-update (Command: custom, Command and arguments: run webdriver-update)
  • Sauce Labs Configuration (Preview)
  • npm run e2e (Command: custom, Command and arguments: run e2e — $(SAUCE_ACCESS_KEY))
  • Sauce Labs Stop Sauce Connect (Preview)
  • Publish Test Results (Test result format; JUnit, Test results files: **\testresult*.xml, Search folder: $(System.DefaultWorkingDirectory))

After the build run is complete, a test report will be available in VSTS. The report will contain detailed information on the test run, pass/fail status, and error messages and stack trace in case of failed tests.

After the tests execution is complete, a report will also be available in Sauce Labs. This report will contain test results, logs, metadata and test report media (screenshots and execution video). The QA team can easily retrieve and use test report media in the further QA process.

The post Integration of Microsoft Visual Studio Team Services, Protractor and Sauce Labs appeared first on codecentric AG Blog.

Categories: Agile, Java, TDD & BDD

What Is Refactoring?

Javalobby Syndicated Feed - Wed, 07-Feb-18 22:01

Refactoring is one of the most used terms in software development and has played a major role in the maintenance of software for decades. While most developers have an intuitive understanding of the refactoring process, many of us lack a true mastery of this important skill. In this article, we will explore the textbook definition of refactoring, how this definition holds up to the reality of software development, and how we can ensure our codebase is prepared for refactoring. Along the way, we will walk-through an entire set of refactorings, from start to finish, to illustrate the simplicity and importance of this ubiquitous process.

A Simple Definition

Refactoring is one of the most self-evident processes in software development, but it is surprisingly difficult to perform properly. In most cases, we deviate from strict refactoring and execute an approximation of the process; sometimes, things work out and we are left with cleaner code, but other times, we get snared, wondering where we went wrong. In either case, it is important to fully understand the importance and simplicity of barebones refactoring. Martin Fowler, the author of the seminal work on the topic, defines refactoring as follows:

Categories: Java

This Week in Spring: Cross-Cloud and Spring Tool Suite 4

Javalobby Syndicated Feed - Wed, 07-Feb-18 14:01

Hi, Spring fans! Welcome to another installment of This Week in Spring! This week I’m in Stockholm, Sweden, for the epic (and snowy) JFokus event, then it’s off to Frankfurt, Germany for the OOP show. If you’re at either event, don’t hesitate to reach out and say hi on Twitter (@starbuxman)!

Categories: Java

EE4J: An Update

Javalobby Syndicated Feed - Wed, 07-Feb-18 10:01

Mike Milinkovich of the Eclipse Foundation has recently posted a blog providing an overall update on the status of the project. To summarize:

  • We are working on defining a new brand name using the community process described here.
  • We have begun the process of moving Oracle GlassFish sources to the EE4J project. So far, Oracle has contributed sources for the following projects:  EE4J GitHub repos
    • Eclipse Grizzly
    • Eclipse OpenMQ
    • Eclipse Project for JAX-RS
    • Eclipse Project for JMS
    • Eclipse Tyrus
    • Eclipse Project for WebSocket
    • Eclipse Project for JSON Processing
  • In addition to the above:
    • The Eclipse Yasson and EclipseLink projects have been transferred to EE4J, and are now part of the overall EE4J project.
    • We have created Eclipse Jersey and Eclipse Mojarra projects and are working on contributing sources for these.
  • You can watch (and star!) EE4J project repositories as they are being created in the EE4J GitHub organization.
  • Oracle is working on Eclipse project proposals for all of the technologies Mike mentions in his blog: JSON-B API, Concurrency, Security, JTA, JavaMail, JAX-B, JAX-WS, JSTL, UEL, JAF, Enterprise Management, and Common Annotations. We intend to formally propose these projects to the EE4J Project Management Committee (PMC) very soon. One of our major near-term goals is to transfer all of the Oracle-owned GlassFish technologies to EE4J such that we can build "Eclipse GlassFish" from EE4J sources and demonstrate Java EE 8 compliance.
  • We are working on establishing an Eclipse Foundation working group to provide a member-driven governance model for EE4J.

In short, there is a lot of positive progress being driven in the EE4J project. For further updates refer to this blog and the links provided above, or subscribe to the ee4j-community mailing list.

Categories: Java

Prometheus With Java EE and MicroProfile Metrics [Video]

Javalobby Syndicated Feed - Wed, 07-Feb-18 04:01

I have recorded a video in which I show how to realize business metrics by integrating Prometheus using Java EE and MicroProfile Metrics on OpenLiberty.

Similar to a previous video that used the Prometheus Java API, we’ll expose “coffee business metrics” from a Java Enterprise application.

Categories: Java

Learning to Use the GraalVM

Javalobby Syndicated Feed - Wed, 07-Feb-18 01:01

In the post "Truffle served in a Holy Graal: Graal and Truffle for polyglot language interpretation on the JVM," we got a brief introduction and a bit of deep dive into Graal, Truffle, and some of the concepts around it. But no technology is fun without diving deep into its practicality, otherwise it's like Theoretical Physics or Pure Maths — abstract for some, boring for others (sorry, the last part was just me ranting).

In this post, we will be taking a look into the GraalVM, by installing it, comparing SDK differences and looking at a some of the examples that illustrate how different languages can be compiled and run on the GraalVM, and also how they can be run in the same context and, finally, natively (more performant).

Categories: Java

Thread Slivers eBook at Amazon

Syndicate content