How to modify an existing json file with Java (add an extra param)

Okay, so you have a json file somewhere, that was already created by someone else, by another project or just due to quantum fluctuation… doesn’t matter, what you want is to read that file, read the json, add another property to that json and then write the entire json back to the file.

Of course it’s not that complicated and can be done in so many ways. I saw a lot of projects that were doing this by simply manipulating the string. This is certainly not recommended since it’s pretty easy to screw up the integrity of that json object.

Instead let’s see one of the easiest and safest way to do it:

Continue reading

Enable Web MVC support for your spring app using Java Config

Hello everyone,

This is not a Spring MVC tutorial. I think there are plenty of those on the internet. I just want to show you how you can enable MVC support and create an API for your app.

Sometimes you might have a simple Spring app or even a JSF+Spring web app and want to expose an API. One way to do this is to use Spring MVC Controllers. It takes only 1 minute, I promise.

Continue reading

GitHub API repo size

This is like a black hole out there… Nobody can tell you exactly the answer. But the answer is not simple at all…
Ok, first of all, there’s a pretty big difference between how the size is calculated for and for GitHub Enterprise.

The short answer is that the size shown doesn’t match the repo’s size after clone. The size shown is as close as possible to the .git folder present in your repo.

Continue reading

Spring JSF Primefaces Nice Template

This is a template project using latest Spring 3.2, latest JSF and latest Primefaces. It’s not just a hello world. It has some jsf templating in place, spring components, lombok annotation, primefaces interaction.
The project is using the port 9996. You also need JAVA 7 for it to run!
I also included a script, that does the entire deploy and run as easy as possible for you.
If you have anything you want to add to the tool or any other template you think might make your life easier then just leave a comment with these nice fantasies 🙂

For the source code go here:
or just do git clone