Subscribe: Javalobby - The heart of the Java developer community
http://www.javalobby.org/forumRSS/17.xml
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
application  boot application  boot  code  data  idea  intellij idea  intellij  java  new  project  ratpack  spring boot  spring  support 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Javalobby - The heart of the Java developer community

DZone Java Zone



Recent posts in Java on DZone.com



 



A Word on toString()

Wed, 29 Mar 2017 07:01:17 GMT

Can you spot the problem?

AccountHolder.java:




Diving Into Java 8's newWorkStealingPools

Wed, 29 Mar 2017 04:01:27 GMT

Concurrency was introduced in Java with version 5.0, and it provided a lot of easy-to-use APIs for writing complex, multithreaded code, which used to be a dreaded area in Java programming. In this, the Executor interface provided a replacement to the original:

new Thread(r).start();




The Stepdown Rule

Tue, 28 Mar 2017 20:01:00 GMT

It has recently occurred to me that some people are ordering the functions in a class randomly, mostly based on gut feelings. It’s a good indicator that we should rehash the old, simple but very important…

Stepdown Rule

The rule tells us that the code in our class should be readable from top to bottom, descending one level of abstraction per function. It implies that the function ordering is no longer random. A caller function should always reside above the callee function.




Spring Testing Improvements in IntelliJ IDEA 2017.1

Tue, 28 Mar 2017 16:01:01 GMT

In the last post, we talked about Spring Data improvements, but it doesn’t stop there. IntelliJ IDEA 2017.1, released last week, has enhanced support for testing using the Spring framework.

Gutter Icons and Navigation

You’ll see that where you use the standard test annotations, you have gutter icons to help you to navigate around the code, the same as you’d usually expect from Spring annotations.  For example, you can see and navigate to the relevant application contexts, and navigate to the declarations of auto-wired beans.




Multi-Tenancy Implementation for Spring Boot + Hibernate Projects

Tue, 28 Mar 2017 15:49:00 GMT

In this article, we'll see how to achieve multi-tenancy in a Spring Boot project using a schema-per-tenant approach.

This article will also offer a way to handle logins in a multi-tenant environment. This is tricky because, at that stage, it is not always clear to which tenant the yet-to-be-logged user belongs.




DZone/Java EE Guardians Survey Results: Microservices

Tue, 28 Mar 2017 07:01:23 GMT

As some of you are aware, the Java EE Guardians and DZone jointly conducted a community survey to help determine Java EE 8 features prior to JavaOne 2016. You may also be aware that we shared the results of that survey with Oracle before the details of the renewed Java EE 8 scope was announced. Now is a great time to start analyzing those results a bit more. I've already done a high-level summary of the results. I've also done a deeper dive into the responses for HTTP/2 and Servlet 4Java SE 8 alignment, as well as Java EE security.

Besides asking about relatively straightforward Java EE 8 features, we asked a number of more complex, foundational questions towards the end of the survey. In the prior entry, in this entry, and a subsequent few others, I am going to take a closer look at some of these questions. I'll then return back to looking at the more mundane Java EE 8 feature-specific questions. It will be clear in a few weeks why this change of order is important at the moment.




Object-Oriented Solutions: Avoiding Getters

Tue, 28 Mar 2017 04:01:36 GMT

Alice and Bob were both working in a small team for an international broker, creating an application to react to certain events in the market. The application’s architecture centered around Trades, that represent transactions between buyers and sellers exchanging something of value on an exchange.

The initial implementation of a Trade was committed by Alice, who designed the Trade according to Object-Oriented principles, concentrating on features the Trade must have, instead of the data it must contain. It looked like this:




Spring: Be Careful When Using PropertyPlaceholderConfigurer

Mon, 27 Mar 2017 20:01:00 GMT

A few days back, one of my juniors came to me and said that when he tested his modules separately in JUnit, everything worked perfectly. But when the modules were deployed to the server as a unit, the server fails to start.

So I checked his code and, fortunately, identified the problem, which we'll discuss here. Let me describe the problem in detail.




Oracle Code New York Report

Mon, 27 Mar 2017 16:01:00 GMT

I recently attended Oracle Code New York City 2017, and I thought I'd go over my experiences and thoughts on them, from keynote speakers to the latest news. Without further ado, let's dive in!

Keynotes

Chris Richardson did an amazing walkthrough and discussion of the what/why/how/when of microservices. This is incredibly powerful material. Chris explains it very well and removes some of the misinformation around microservices. A full two hours from the keynotes are already on YouTube.




Fully Configurable Mappings for Spring MVC

Mon, 27 Mar 2017 10:01:00 GMT

As I wrote some weeks earlier, I’m trying to implement features of the Spring Boot actuator in a non-Boot Spring MVC applications. Developing the endpoints themselves is quite straightforward. Much more challenging, however, is to be able to configure the mapping in a properties file, like in the actuator. This got me to check more closely at how it was done in the current code. This post sums up my “reverse-engineering” attempt around the subject.

Standard MVC

Usage

In Spring MVC, in a class annotated with the @Controller annotation, methods can be in turn annotated with @RequestMapping. This annotation accepts a value attribute (or alternatively a path one) to define from which path it can be called.




Java Regex: Simple Patterns

Mon, 27 Mar 2017 07:01:00 GMT

Regular Expressions are the bread and butter of string pattern matching. They allow you to express a search pattern in general terms without being too specific about what you are searching for.

This article covers the basics of string pattern matching using regular expressions.




Entity Objects Power Ranking

Mon, 27 Mar 2017 04:01:00 GMT

There seems to be an ever-ongoing discussion about how powerful an entity object should be. That’s indeed a very valid discussion, as the choice that we make (often unconsciously) will have a huge impact on the final shape of our application. Let’s see what options do we have and try to analyze the consequences of each.

Anemic Objects

(image)




Becoming a Senior Engineer (Part 2)

Sun, 26 Mar 2017 09:01:01 GMT

In my previous article (Becoming a Senior Engineer, Part 1) I explored, in brief, the strategy for going from junior to mid to senior software and DevOps engineer. The conclusion? Practice, practice, and practice more. Today, I want to revisit the topic from a new perspective, which is one that is sorely overlooked throughout the growth and mentorship of engineers.

Since I wrote the article, over 20,000 people have read it (including the guest spot on the media.pch.com blog), and I’ve gotten a tremendous amount of feedback, most of which has been extremely positive! PCH Media has also adopted this strategy for career progression in other parts of the business, and it has been used by our parent organization as well! One of the biggest pieces of feedback I received was that there wasn’t enough focus on the personal. There’s one subject on the interpersonal, and a strong concentration on technical ability, but the squishy, hard-to-nail-down personal categories were missing.




IntelliJ IDEA 2017.1: Java 9, Kotlin 1.1, Spring, Gradle, JavaScript, Go, and More

Sat, 25 Mar 2017 05:01:00 GMT

IntelliJ IDEA 2017.1 is available for download! In addition to many important bug fixes, this massive update brings lots of improvements to supported languages, frameworks, and built-in tools. Java 9: The latest builds of JDK 9 are fully supported, with assisted project import and coding assistance for editing module declarations. Built-in inspections validate module declarations and provide quick-fixes for adjusting project dependencies. Learn more… Java 8: Quick-fixes that help migrate for loops to Stream API calls have been improved and now support more sophisticated scenarios. We’ve also added a quick-fix that turns Stream API calls back into for loops, which is handy for debugging or exploring code. Async-aware debugger: Async stacktraces is a new feature that substitutes parts of a stack trace related to asynchronous code execution with data captured from where that code is invoked. This helps you focus on what you’re debugging. An improved Smart Step Into also supports asynchronous code and lambda expressions running on other threads. Better VCS: The Log panel for Git and Mercurial has new display options, the Diff dialog gets an option to Ignore imports and formatting, and File History for Git is now faster. We’ve also added Favorite Branches and Speed Search to the Branches popup for Git. Search: The Find in Path dialog, which previously had added a Preview tab, has been reworked from the ground up and now shows instant results in the first place. What is more important, now you can open any selected result in the Editor simply by pressing Enter. Spring: Spring Testing has been updated to support Spring Boot 1.4.3, and the upcoming Spring 5.0. Spring Data tools are updated to version 2.0 (including MongoDB, Redis, Solr, KeyValue, Gemfire, Apache Cassandra, REST, Neo4j, Couchbase, and Elasticsearch). There’s also a new Data tab in the Spring tool window which brings better repository navigation. Gradle: Support for Composite Builds is much improved with the detection of includeBuild in Gradle settings and automatic project configuration. Kotlin 1.1: Among other things, the new version of this JVM language introduces coroutines—the new non-blocking asynchronous API, and fully supports compilation to JavaScript. This means you can use Kotlin strings, collections, sequences, arrays and other core API in your JavaScript apps. Scala: Scala plugin improvements include a simpler Project Wizard, better SBT support, additional Akka-specific coding assistance, and the new Worksheet REPL mode. JavaScript: We’re bringing first-class support for Vue, lots of new code style options for JavaScript and TypeScript, faster and more reliable integrations with Angular, ESLint and TSLint (including language service support and TSLint-powered quick-fixes). Plus, simpler editing of project dependencies in package.json with package names and versions completion and easier running of Mocha and Jest tests with the new Run gutter icon that also displays test state. Go: Gogland, the new Go IDE that we announced several months ago now also becomes IntelliJ IDEA Ultimate plugin. Database tools: IntelliJ IDEA now allows you to transfer table schemas and data between any two databases (yes, even from MySQL to Microsoft SQL Server and back). Emoji: The editor now supports Unicode emoji characters (handy for writing comments). Android Studio 2.2.2: This update includes all changes from Android Studio 2.2.2. Docker: The Docker plugin now supports Docker for Mac and works via “unix://”. For more details about IntelliJ IDEA 2017.1, check out the What’s New page.[...]



URL Encoding and Decoding Using Java

Fri, 24 Mar 2017 20:01:00 GMT

It is a common requirement to implement URL encoding and decoding in Java while creating crawlers or downloaders. This post focuses on creating modules for encoding and decoding of a passed URL. You can take a look at the source code on GitHub.

Main Method

 public static void main(String[] args) {  
           // TODO Auto-generated method stub  
           String url="https%3A%2F%2Fr1---sn-ci5gup-cags.googlevideo.com%2Fvideoplayback%3Fpcm2cms%3Dyes%26mime%3Dvideo%252Fmp4%26pl%3D21%26itag%3D22%26\u0026itag=43\u0026type=video%2Fwebm%3B+codecs%3D%22vp8.0%2C+vorbis%22\u0026quality=medium";  
           String url2="https://r1---sn-ci5gup-cags.googlevideo.com/videoplayback?pcm2cms=yes&mime=video/mp4&pl=21&itag=22&&itag=43&type=video/webm; codecs=\"vp8.0, vorbis\"&quality=medium";  
           String decodeURL = decode(url);  
           System.out.println("Decoded URL: "+decodeURL);  
           String encodeURL = encode(url2);  
           System.out.println("Encoded URL2: "+encodeURL);  
      }  


How It Works

  1. url is the variable containing the encoded URL that we want to decode.




Spring Tips: Servlet Container Deployment Options [Video]

Fri, 24 Mar 2017 16:01:00 GMT

Speaker: Josh Long

Hi, Spring fans! In this tip, we’ll look at deploying to, and integrating with, embedded (like Apache Tomcat, Eclipse Jetty, and RedHat’s Undertow) and standalone Servlet containers (like the WildFly application server) in a Spring Boot application.




Java Streams groupingBy Examples

Fri, 24 Mar 2017 10:01:00 GMT

Have you wanted to perform SQL-like operations on data in a List or a Map? Maybe computing a sum or average? Or perhaps performing an aggregate operation such as summing a group? Well, with Java 8 streams operations, you are covered for some of these.

A previous article covered sums and averages on the whole data set. In this article, we show how to use Collectors.groupingBy() to perform SQL-like grouping on tabular data.




Ratpacked: Add Ratpack to Spring Boot Applications

Fri, 24 Mar 2017 07:01:00 GMT

In a previous post, we saw how we can use Spring Boot in a Ratpack application. But the integration can also be the other way around: using Ratpack in a Spring Boot application. This way, we can use Ratpack's power to handle requests sent to our Spring Boot application and still use all Spring Boot features in our application. The easiest way to add Ratpack to a Spring Boot application is adding a Ratpack dependency and using the @EnableRatpack annotation. With this annotation, a RatpackServer instance is created and started along with configuration options.

Let's see an example Spring Boot application with Ratpack enabled. First, we add Ratpack as a dependency to our Spring Boot application. In our example, we also add Ratpack's Dropwizard module as a dependency. We use Gradle in our example:




The Open-Closed Principle Is Often Not What You Think

Fri, 24 Mar 2017 04:01:20 GMT

jOOQ is a library that loves making everything internal final and package private. We have tons of classes like these:

final class Concat extends AbstractFunction {
    // ...
}





A Look at IntelliJ IDEA's Support for Java 9 Modules

Thu, 23 Mar 2017 20:01:00 GMT

IntelliJ IDEA 2017.1 brings support for Java 9’s new modularity (Project Jigsaw). In this latest version, support includes code completion in the module-info.java file, and quick fixes for adding modules to your project.

Let’s take a look at a basic example of a modular project. To start with, we just have an ordinary IntelliJ IDEA module that contains a simple “Hello World” type application.