Java Code Geeks http://www.javacodegeeks.com/ Java 2 Java Developers Resource Center Fri, 24 Apr 2015 19:00:13 +0000 en-US hourly 1 http://wordpress.org/?v=4.1.1 JUnit: Testing Exceptions with Java 8 and AssertJ 3.0.0http://www.javacodegeeks.com/2015/04/junit-testing-exceptions-with-java-8-and-assertj-3-0-0.html http://www.javacodegeeks.com/2015/04/junit-testing-exceptions-with-java-8-and-assertj-3-0-0.html#comments Fri, 24 Apr 2015 19:00:13 +0000 http://www.javacodegeeks.com/?p=39454 AssertJ 3.0.0 release for Java 8 makes testing exceptions much easier than before. In one of my previous blog post I described how to utilize plain Java 8 to achieve this, but with AssertJ 3.0.0 much of the code I created may be removed. Warning: this blog post contains mostly the code examples.     ...

 

]]>
http://www.javacodegeeks.com/2015/04/junit-testing-exceptions-with-java-8-and-assertj-3-0-0.html/feed/ 0
Using Rhino with Java 8http://www.javacodegeeks.com/2015/04/using-rhino-with-java-8.html http://www.javacodegeeks.com/2015/04/using-rhino-with-java-8.html#comments Fri, 24 Apr 2015 16:00:21 +0000 http://www.javacodegeeks.com/?p=39453 Java brings Nashorn as new JavaScript implementation for JSR 223 (javax.scripting). While this is certainly great news (Nashorn is way faster than Rhino by directly generating Java code), it comes with some challenges: Nashorn is not 100% compatible with Rhino. Rhino had some extensions and more or less other interpretations on how to combine the ...

 

]]>
http://www.javacodegeeks.com/2015/04/using-rhino-with-java-8.html/feed/ 0
Spring: injecting lists, maps, optionals and getBeansOfType() pitfallshttp://www.javacodegeeks.com/2015/04/spring-injecting-lists-maps-optionals-and-getbeansoftype-pitfalls.html http://www.javacodegeeks.com/2015/04/spring-injecting-lists-maps-optionals-and-getbeansoftype-pitfalls.html#comments Fri, 24 Apr 2015 13:00:02 +0000 http://www.javacodegeeks.com/?p=39409 If you use Spring framework for more than a week you are probably aware of this feature. Suppose you have more than one bean implementing a given interface. Trying to autowire just one bean of such interface is doomed to fail because Spring has no idea which particular instance you need. You can work around ...

 

]]>
http://www.javacodegeeks.com/2015/04/spring-injecting-lists-maps-optionals-and-getbeansoftype-pitfalls.html/feed/ 0
Know Your IDE: Eclipsehttp://www.javacodegeeks.com/2015/04/know-your-ide-eclipse.html http://www.javacodegeeks.com/2015/04/know-your-ide-eclipse.html#comments Fri, 24 Apr 2015 10:00:13 +0000 http://www.javacodegeeks.com/?p=39408 When I made the switch from .NET to Java, I naturally had to switch IDEs. With moving to Java, I chose Eclipse. I was fortunate to have a great group of coworkers that took time out of their schedule to share shortcuts and tips to allow me to utilize Eclipse to the fullest extent. One ...

 

]]>
http://www.javacodegeeks.com/2015/04/know-your-ide-eclipse.html/feed/ 1
JAX-RS 2.x vs Spring MVC: Returning an XML representation of a list of objectshttp://www.javacodegeeks.com/2015/04/jax-rs-2-x-vs-spring-mvc-returning-an-xml-representation-of-a-list-of-objects.html http://www.javacodegeeks.com/2015/04/jax-rs-2-x-vs-spring-mvc-returning-an-xml-representation-of-a-list-of-objects.html#comments Fri, 24 Apr 2015 07:00:25 +0000 http://www.javacodegeeks.com/?p=39407 JSON is King as it goes to all kinds of REST* APIs, but still you may need to expose multiple representations, including XML. With both JAX-RS and Spring MVC this is very simple. Actually, the only thing to do is to annotate POJOs returned from the API call with JAXB annotation and that’s it. But ...

 

]]>
http://www.javacodegeeks.com/2015/04/jax-rs-2-x-vs-spring-mvc-returning-an-xml-representation-of-a-list-of-objects.html/feed/ 0
Using AWS SQS as JMS provider with Springhttp://www.javacodegeeks.com/2015/04/using-aws-sqs-as-jms-provider-with-spring.html http://www.javacodegeeks.com/2015/04/using-aws-sqs-as-jms-provider-with-spring.html#comments Fri, 24 Apr 2015 04:00:34 +0000 http://www.javacodegeeks.com/?p=39406 Recently AWS published a new client library that implements the JMS 1.1 specification and uses their Simple Queue Service (SQS) as the JMS provider (see Jeff Barr’s post here). In my post I will show you how to set up your Maven project to use the Spring Framework to use this library. We will perform ...

 

]]>
http://www.javacodegeeks.com/2015/04/using-aws-sqs-as-jms-provider-with-spring.html/feed/ 0
Time to toss out Java 7 – JBoss EAP 6.4 is here!http://www.javacodegeeks.com/2015/04/time-to-toss-out-java-7-jboss-eap-6-4-is-here.html http://www.javacodegeeks.com/2015/04/time-to-toss-out-java-7-jboss-eap-6-4-is-here.html#comments Thu, 23 Apr 2015 22:00:45 +0000 http://www.javacodegeeks.com/?p=39405 What a great end to the week. JBoss EAP 6.4 was released and among a ton of technical enhancements and new features, the biggest is: Java 8 has been added to the list of supported configurations. And this includes the Oracle JDK and IBM JDK. Java SE 7 End of Public Updates Notice After April ...

 

]]>
http://www.javacodegeeks.com/2015/04/time-to-toss-out-java-7-jboss-eap-6-4-is-here.html/feed/ 0
The JDK 8 SummaryStatistics Classeshttp://www.javacodegeeks.com/2015/04/the-jdk-8-summarystatistics-classes.html http://www.javacodegeeks.com/2015/04/the-jdk-8-summarystatistics-classes.html#comments Thu, 23 Apr 2015 19:00:26 +0000 http://www.javacodegeeks.com/?p=39391 Three of the new classes introduced in JDK 8 are DoubleSummaryStatistics, IntSummaryStatistics, and LongSummaryStatistics of the java.util package. These classes make quick and easy work of calculating total number of elements, minimum value of elements, maximum value of elements, average value of elements, and the sum of elements in a collection of doubles, integers, or ...

 

]]>
http://www.javacodegeeks.com/2015/04/the-jdk-8-summarystatistics-classes.html/feed/ 0
Docker 1.6 released – Docker Machine 0.2.0http://www.javacodegeeks.com/2015/04/docker-1-6-released-docker-machine-0-2-0.html http://www.javacodegeeks.com/2015/04/docker-1-6-released-docker-machine-0-2-0.html#comments Thu, 23 Apr 2015 16:00:20 +0000 http://www.javacodegeeks.com/?p=39392 Docker 1.6 was released yesterday. The key highlights are:                   Container and Image Labels allow to attach user-defined metadata to containers and images (blog post) Docker Windows Client (blog post) Logging Drivers allow you to send container logs to other systems such as Syslog or a third-party. This available ...

 

]]>
http://www.javacodegeeks.com/2015/04/docker-1-6-released-docker-machine-0-2-0.html/feed/ 0
Spring From the Trenches: Returning Git Commit Information as JSONhttp://www.javacodegeeks.com/2015/04/spring-from-the-trenches-returning-git-commit-information-as-json.html http://www.javacodegeeks.com/2015/04/spring-from-the-trenches-returning-git-commit-information-as-json.html#comments Thu, 23 Apr 2015 13:00:18 +0000 http://www.javacodegeeks.com/?p=39390 There are situations when we must know the exact version of our web application that is deployed to a remote server. For example, a customer might want to know if we have already deployed a bug fix to the server X. We can, of course, try to find an answer to that question by using ...

 

]]>
http://www.javacodegeeks.com/2015/04/spring-from-the-trenches-returning-git-commit-information-as-json.html/feed/ 0