First up, you need to configure a @Bean in your @SpringBootApplication class (full source is on GitHub here):
Fri, 24 Feb 2017 20:01:00 GMT
Is the Actor Model just a new "shiny object" for developers to chase after, a fad soon to be abandoned? In fact, the Actor Model was first designed in 1973–over 20 years before brands like Yahoo! and Hotmail first showed up on the young internet. Created to address the long-term direction of computing and software development, the Actor Model is almost as old as object-oriented programming itself, and, according to Forrester Research in a recent webinar, is seeing “renewed interest as cloud concurrency challenges grow."
Fast forward to 2017, where we are faced with an online and mobile world that continues to grow exponentially, and a third wave of IoT aims to add hundreds of billions of connected devices to our lives. To manage today’s demanding needs and to prepare for the coming wave, enterprises like Intel, Samsung, Walmart, PayPal, Hootsuite, and Norwegian Cruise Lines (read these case studies) are embracing distributed, Reactive systems deployed on hybrid cloud infrastructures. In this webinar, special guest Vaughn Vernon explains why actors are so vital to the future of developing Reactive systems. You will learn:
Fri, 24 Feb 2017 17:01:00 GMTWelcome to another installment of This Week in Spring! This week, I’m in Atlanta, Georgia, for the incredible DevNexus event, and then it’s off to Geneva, Switzerland, for the Voxxed CERN event. As usual, don’t hesitate to say “Hi” if you’re around! Thomas Risberg just announced Spring Cloud Data Flow 1.2.M1 Spring IO Platform lead Andy Wilkinson has just announced the Spring IO Platform Brussels release which introduces Spring Kafka to the release train and updates several others. InfoQ’s Charles Humble takes a look at the future of Enterprise Java via the lens of the Geoffrey Moore’s Chasm metaphor in this article. Last week, in another installment of Spring Tips, we looked at how to use JOOQ with Spring Boot. Using Java FX? This nice post by Gregg Bolinger shows how to use Spring with JavaFX, and have it be your controller factory. Check out community hero Michael Simons’ German-language JAX talk introducing Spring Boot starters. Deepak Tyagi put together a nice post on building applications that carry on in the face of a cache failure using the Spring Cache abstraction. Aboullaite Mohammed put together an interesting look at using JWT with Spring Boot. It’s a good first cut! Want to test against an in-memory MongoDB database? This Brazillian-language blog explaining how to use Spring Boot and Fongo might be just for you. Matt McCandless does a nice job introducing Spring Boot in this post: “Just put them on and lace them up!” Interesting post on the OpenShift blog on how to use Spring Boot and their Hawkular APM tool. This is an interesting look at using Spring Boot with Hazelcast. Dhiraj Ray explains how to use Spring MVC (in a Spring Boot application) with Apache Tiles. Christoph Burmeister looks at how to load-balance Spring Boot applications with Nginx. This DZone post introduces basic dependency injection with Spring. [...]
Fri, 24 Feb 2017 11:01:01 GMT
After hearing my colleague constantly talking about the editable grids that the company I work at designed a long time ago, I decided to do something to make him proud of me. So I wrote an application that creates an editable TableView in JavaFX that can be used to brainlessly enter in data, if that’s what you want to do. Unfortunately, JavaFX didn’t want to make this nice and simple, and I even found a bug in the JavaFX code while writing the example code… So buckle up, as there is a lot of code in this post. And don’t worry, I’ll put some explanations and even pictures in so you don’t get lost.
Check out Making Apps with JavaFX if your need some background knowledge in what will be explained in this post.
Fri, 24 Feb 2017 08:01:00 GMT
As the college basketball season winds down, teams across the United States prepare for what is called March Madness. March Madness is the name that has been given to the National Collegiate Athletic Association (NCAA) men's basketball tournament to determine the championship team for a given season. There is also a tournament for the women's NCAA basketball teams as well.
How the Tournament Works
Beginning in 1985, March Madness has been designed as a 64+ team, single-elimination tournament. There are four brackets of 16 teams, which are seeded so that the first team in the bracket plays the sixteenth team in the bracket. Doing so is intended to build up excitement as the better teams face each other later in the tournament.
Fri, 24 Feb 2017 05:01:00 GMT
Should Iterators be used to modify a custom Collection?
Thu, 23 Feb 2017 21:01:00 GMT
I've been doing a bit of traveling lately on the second leg of the Getting Git Right tour. It's been a blast meeting so many devs from around the world. It's been particularly incredible to see how much git adoption has grown amongst attendees in the few months since we did the first leg of the tour. When we presented in July, almost all attendees raised their hand when we asked, "Who's using git?"
However, there is one low point during every evening that I've hosted: the moment after I ask the question "Who's doing code review at work?"
Thu, 23 Feb 2017 17:01:00 GMT
Spring Boot RestControllers, by default, can return a POJO class as the return result from a mapped request method, and it is converted into a JSON result. I’ve run into this issue before though, and it’s not immediately obvious what’s wrong: ‘No converter found for return value of type’:
java.lang.IllegalArgumentException: No converter found for return value of type: class kh.springboot.redis.domain.RedisResult at org.springframework.web.servlet.mvc.method.annotation .AbstractMessageConverterMethodProcessor .writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:187) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
Thu, 23 Feb 2017 11:01:00 GMT
Interface was meant to define a contract before Java 8, where we were able to define the methods a class needed to implement if binding himself with the interface. Interface was only involved with abstract methods and constants.
But in Java 8, Interface has become much more, and now it can have methods defined using static or default. Remember that default methods can be overridden, while static methods cannot.
Thu, 23 Feb 2017 08:01:00 GMT
In Groovy, we can add a method named
call to a class and then invoke the method without using the name
call. We would simply just type the parentheses and optional arguments on an object instance. Groovy calls this the call operator:
(). This can be especially useful in for example a DSL written with Groovy. We can add multiple
call methods to our class, each with different arguments. The correct method is invoked at runtime based on the arguments.
In the following example, we have a
User class with three
call method implementations. Next, we see how we invoke the
call methods, but without typing the method name and just using the parenthesis and arguments:
Thu, 23 Feb 2017 05:01:00 GMT
Few programmers explicitly intend to write poorly structured source code.
They don't sit down, whip out their Bad Code Design Patterns book, and wreak meticulous spaghettipocalypse. Rather, poorly structured code is what happens when programmers don't know what they're doing.
Wed, 22 Feb 2017 20:01:00 GMT
Early this year, I was leading the development efforts of a project that had acquired a lot of technical debt in the form of business rules. Like many projects in their early stages, these business rules were defined in a growing tangled mess of if/then/else statements. It didn't take long before it was obvious that all of those tightly coupled if/then/else rules needed an abstraction where each rule could be defined independently, while still somehow chained together.
Finding the Perfect Rules Engine
First, we looked at Drools, but we quickly decided that Drools was much more than we needed. Besides that, many developers were unfamiliar with Drools. So, Drools would be yet another technical hurdle on a project that was already using a slew of new tech and with a team that was still struggling to keep up.
Wed, 22 Feb 2017 17:01:00 GMT
We can limit the opportunities for NullPointerExceptions by following good practice like:
- Don’t return nulls from methods
- Don’t pass nulls as arguments
Another tool is to use java.lang.Optional. Java 8 Optionals formalize the approach used in other languages (and that already existed in some Java libraries). Optional is simply an object wrapper. The key to its use is to use the methods in the Optional classes.