Tech Notes
Spring Bean vs Spring Component
· ☕ 3 min read · ✍️ Dinesh
The Difference Between @Bean and @Component and When to Use What? This is the most common question that new as well as experienced Spring users get confused about. There are literally hundreds of questions on this Stackoverflow. This article will clear all the confusion. Similarities between @Bean and @Autowired @Bean @Bean is an annotation based configuration and hence is used in @Configuration based class. This is an explicit way of defining a bean and is also used on the methods defined in configuration class.

Scala: Tail Recursion
· ☕ 3 min read · ✍️ Dinesh
Tail recursion is a basic but important concept in Functional programming. Recursive functions has always been a pain point for me. I would be eliminated out of several interview rounds if interviewers places emphasis on recursion. In Java world thankfully, most people I know hate recursion because when nesting goes too deep, it impacts the performance if the nested recursion is more than 100 levels deep. Unfortunately(Fortunately), functional programming languages like Scala and Haskell have solved this concept with the term Tail Recursion.

Understanding Java 8 Lambda final finally variable
· ☕ 3 min read · ✍️ Dinesh
I am a little late to the java 8 party and was trying to quickly get some hands on with lambdas and ran into an issue where I got the error message Variables used in lambda should be final or effectively final . I know what final is but what is effectively final. Here is what I was trying to do. I had a HashMap which had values like “one : 1”, “two : 2”, “three : 3” and wanted to replace the String ${one} with 1 etc.

How to set up Apache Storm on mac using brew
· ☕ 3 min read · ✍️ Dinesh
I am learning about Apache Storm and the guide had long and winding instructions on how to install Apache Storm. I installed the single node using brew and it was a breeze. I did not had to spend time figuring out out if I was installing latest version. Pre-requisites: Make sure that you have ‘HomeBrew‘ installed. One reason that I prefer ‘brew’ is that I do not have to remember where things are installed and brew manages and fixes any updates that have been introduced.

Waffle : Windows Single Sign On
· ☕ 3 min read · ✍️ Dinesh
Last week, I was working on an application where I had to do LDAP authentication. My cmpany has been using a very old jar file that had the required code for authenticating and authorizing users. There were two problems for me. I had to revisit the documentation on LDAP setting in Jboss 4 and figure how to do the set up. Making changes in login-config.xml etc. My new application is using Spring-boot, which comes with built in tomcat libraries.

4 ways to set up datasources in Jboss AS 7
· ☕ 5 min read · ✍️ Dinesh
Last year my company decided to move from JBoss 4.x/5.x to Jboss AS 7. We use Maven and IZPack plugin to create automated deployment to Jboss 4. As a part of IZPack plugin, we would write the install.xmls for various environment, which would help us deploy war files, log.xml, jars, properties file in respective folders. So the advantage was that Jboss-4 allows you to deploy several xxx-ds.xml files in deploy folder and you can have multiple apps deployed in same Jboss and each app uses it’s respective xxx-ds.

Install Or Manage multiple versions of Java on OS X
· ☕ 3 min read · ✍️ Dinesh
A few weeks ago my Mac hard drive crashed and I had to get a new grad drive. As part of upgrade, I had to wipe my drive clean and install Yosemite. What I did not realize was that Apple had goofed up Java instlation on Mac, as result of which my IntelliJ idea compalained that it requires legacy Jdk version of Java 6. The dilemma that I had was hwo am I going to mainain the different version of Java.

Restful Webservice in 7 Steps using Spring boot
· ☕ 5 min read · ✍️ Dinesh
Last week I was working on a new application which required me to build a web service to access it’s functionality. I decided to check out Spring 4 RestController. I was amazed at how far we have come from writing all the boiler template code, xmls etc for making a restful call. With Spring4 boot, it was matter of adding simple annotation for RestController. I will be honest, I have not been up to date on how to use a Restful webservice, I built a couple of Restful service a couple of year ago, but most of the services in my current project are old school (SOAP calls), so I never got a chance to build one from scratch and at peace.

A quick tutorial on SAAJ API
· ☕ 6 min read · ✍️ Dinesh
We ran into an issue last week. I had to call a third party web service that was built in PHP. Anyone who wokrs with Java will tell you that calling a web service is not more 15 minutes coding. You take the wsdl, run wsdl2Java command from Axis2 and start calling the service. Like I said before, things are never so straightforward. No matter what version of Axis or CXF we used, we kept getting this error:

Read / Write Excel file in Java using Apache POI
· ☕ 6 min read · ✍️ Dinesh
About a year or two ago I was working with finance team where they wanted to pull the credit card transactions for all the customer using various combinations. Ex – – Get the credit card txns for today or certain date. – Get the txns for customer who used Mastercard or Visa. However they wanted this application to generate a Excel file and save it on their local machine so that they could prepare reports for our CEO.

13 Most Common Java Keytool Keystore Commands
· ☕ 3 min read · ✍️ Dinesh
I was working on a project last month where I had to call a third-party web service. The third-party web service wanted me to add a SSL keystore and I struggled. I could have gone to my UNIX Admin and asked him to do this job but decided to learn about all about keystores. I went through couple of forums and SO and ended my spending 2 – 3 hours reading about keystores and commonly used commands.