Monday, 6 June 2011

Debug with Step Filters in Eclipse

Eclipse tip: Add a short cut key to Skip All Breakpoints

Eclipse doesn’t have a short cut key bound by default to the ‘Skip all breakpoints’ functionality. So again and again I had to manually skip the breakpoints.
Here is how you can set the short key. While you are at it, you probably want to define a few more shortcuts to functionality you use frequently.
In Eclipse, go to Window > Preferences > Type in ‘Keys’ in the search box > Select ‘Keys‘ to get the screen to edit the command bindings.
Search for the ‘Skip All Breakpoints’ command. Add your preferred shortcut at the Binding field, and in When use debugging.
 I use Ctrl+Alt+B. So when I press Ctrl+Alt+B all break points are skipped. If I again press it all breakpoints are restored.
If you toggle that bit of functionality as often as I do, you know this is gonna save you a bunch of time.

Saturday, 4 June 2011

Eclipse Error : failed to load the JNI shared library "some path\jvm.dll"

http://www.satya-weblog.com/2010/07/eclipse-error-failed-to-load-the-jni-shared-library-cprogram-files-x86javajre6binclientjvm-dll.html

Thursday, 2 June 2011

Getting started with Android in IntelliJ 9

http://codingbone.wordpress.com/2009/10/03/getting-started-with-android-in-intellij-9/

Monitoring OSCache statistics with JMX

http://codingbone.wordpress.com/2010/07/07/monitoring-oscache-statistics-with-jmx/

@ContextConfiguration : Getting the context file via annotations in Spring, using JUnit

I was just working on a JUnit test today, and saw the annotation @ContextConfiguration which is good way of providing beans directly in unit test, rather than getting the bean via getBean or any method like we used to do (See here for these methods ). 
To instruct Spring to load beans for the tests in the class, we annotate the class with @ContextConfiguration.
There can be various ways we can use this annotation, lets have a look at it one by one:

No File Specified

@ContextConfiguration – with no parameters, (by Default) looks for the config file as the same name as the class with the suffix “-context.xml“. For example,
Suppose our class is Greeting.java and our context file is spring-context.xml

package com.vaani.contextconfig;

@ContextConfiguration
public class Greeting{
...
}
Well this is equivalent to

@ContextConfiguration("/com/vaani/contextconfig/spring-context.xml")
public class Greeting{

File specified (without a starting Slash)


package com.vaani.contextconfig;
@ContextConfiguration("spring-context.xml")
public class Greeting{

Again this is equivalent to fully qualified package path of Greeting class.

File specified with a Starting Slash

One Simple change can ruin your whole day! Add a Starting Slash to the file name.
package com.vaani.contextconfig;
@ContextConfiguration("/com/vaani/contextconfig/spring-context.xml")
public class Greeting{

We can give fully qualified path of the spring-context file in this annotation.

Multiple Files

Pulling multiple configuration files into the application context for your tests.
@ContextConfiguration(locations = {"spring-context.xml", "other-context.xml"})

Just a tip
Create an XML file per test that imports only the application’s context files that are needed.
This can save test execution time, where we only load beans necessary for these tests.

Wednesday, 1 June 2011

spring resource

http://springnm.blogspot.com/2011/05/query-for-list-long-map-and-object-in.html
http://learn2program.wordpress.com/category/spring/
http://gordondickens.com/wordpress/2011/01/07/junit-spring-what-you-dont-know-about/
http://codingbone.wordpress.com/tag/java/