Be aware of the users in Spring!

I tried to be figurative in the header only to break the spleen mood of this rainy morning. This blog is about Spring Framework and keeping track of the session data, particularly logged in user.

Read more

Leave a comment · Posted in Blog, Five Minutes, Java, Technology

Java Heap Dump

Memory leaks are notoriously hard to debug. Java, with its built in garbage collector, handles most memory leak issues. True memory leak happens when objects are stored in memory but are not accessible by running code. These kinds of inaccessible objects are handled by Java garbage collector (in most cases). Another type of memory leak happens when we have an unneeded reference to the object somewhere. These are not true memory leaks as objects are still accessible, but none the less can cause some nasty bugs.
Read more

3 Comments · Posted in Blog, Java

Using mock objects for Stripes-Spring testing

It is very easy to create a mock objects of your Spring layer, and not only does it allow you to create a consistent junit tests, but in the process you will end up with a mocked spring layer which you can use for fast front-end development!
Let’s see how.

Read more

1 Comment · Posted in Blog, Five Minutes, Java, Software testing, Technology

Check user permission using aspect-oriented programming

In this post we will show a example of simple and clean way to check your users permissions across your application using aspect-oriented programming (AOP).
Read more

Leave a comment · Posted in Blog, Five Minutes, Java, Technology

Using Drag&Drop on tree structure with SmartGwt

The TreeIt has never been as easy to create a thin client web application as it is with the tools such as GWT and it’s third party library SmartGwt. This is a deadly combination which has out-of-the-box support for drag&drop, asynchronous remote procedure calls, localization, history management and much more inherited from GWT (Google Web Toolkit) and accompanied with numerous customizable widgets (lists, trees, buttons, layout support widgets, HTML5 support…). In this text, a simple drag&drop implementation will be demonstrated.

Read more

2 Comments · Posted in Blog, Java, Technology

The importance of using correct JDK

It’s always a good idea to have your development environment as close as possible to production. When working with Java first thing to consider is JDK version. It’s possible to use a newer version of JDK for development but it’s not a good idea. A couple of problems can arise if our development JDK version is different from target version.
Read more

Leave a comment · Posted in Blog, Java

Maven release plugin – 8 tips & tricks

Recently I’ve been working intensively with Maven and it’s release plugin and I wanted to share some things I learned while scripting release process for our project. I wish I could say that everything’s been as easy as “advertised” in plugin’s documentation but unfortunately there were some problems to overcome and also some things I needed that weren’t supported by plugin (e.g. sending of notification email to the team after successful release). So here are 8 tips & tricks to help you release your code like a champ…

Read more

6 Comments · Posted in Blog, Java

Unit testing with Stripes

Unit testingI’ll describe here how to do unit  testing on ActionBeans when working with Stripes technology. More specifically, I’ll focus on testing approach using MockRoundtrips.

Stripes comes with large set of mock objects which implement interfaces in Servlet specification. We’ll focus on two of them: MockServletContext and MockRoundtrip. Read more

Leave a comment · Posted in Blog, Java, Technology

Solving the text hell

I worked on several projects that had lots of problems with how they handled texts. Especially the problem was more expressed in bigger projects that had several teams working on them. The problem usually comes from process – who defines text key naming convention, do developers follow these convention, who writes and translates texts, how are frequent change requests from customer handled, internationalization etc… Some projects end up having lots of unused text keys, and perhaps some text values are not even defined. The one problem I run into is having almost same key value pairs in same property file, the only difference being case of one letter of text key.
Read more

Leave a comment · Posted in Blog, Java, Technology

Logging with Spring AOP

Aspect Oriented Programming allows you to “define cross-cutting concerns that can be applied across separate, very different, object models”. AOP complements Object Oriented Programming by increasing modularity with applying common behavior to multiple non-related object models. Basically, think about AOP as an interceptor for method calls, where you can add extra functionality.

Spring AOP is one of the key components of Spring Framework. It is very easy to start with, and can be used for getting complicated things done very easy. For example, Spring Transactional Management is made possible using Spring AOP.

Here you will see how to add logging of method calls with Spring. On every call you can log method name, method arguments, returned object, as well as method execution time. So you can use AOP as a profiler, where you can check where are the bottlenecks of your application.
Read more

2 Comments · Posted in Blog, Java