Posts

Showing posts from January, 2013

What is Maven repository ?

Maven Repository : A repository is a place where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily. There are three types of repository :  local central remote  Local Repository : The maven local repository is a local folder that is used to store all your project’s dependencies (plugin jars and other files which are downloaded by Maven). In simple, when you build a Maven project, all dependency files will be stored in your Maven local repository. The default name of the Maven's local repository is .m2. Central Repository Maven central repository is repository provided by Maven community. It contains a large number of commonly used libraries. When you build a Maven’s project, Maven will check your pom.xml file, to identify which dependency to download. First, Maven will get the dependency from your local repository, if not found, then get it from the default Maven central repo...

how to install MAVEN on linux

What is MAVEN ? Read here : http://maven.apache.org/ Here are the steps to download and install Maven on linux : Step 1 : Download the latest binary from the http://maven.apache.org/download.cgi.              apache-maven-3.0.4-bin.tar.gz Step 2 : Untar it using tar command.               tar -zxvf /usr/local/apache-maven-3.0.4-bin.tar.gz Step 3: Add Maven binary Path to the System Path i,e add in .bash_profile path           $ cd $HOME           $ vi ~/.bash_profile Set PATH and M2_HOME as follows M2_HOME=/usr/local/apache_maven-3.0.4 PATH=PATH=$PATH:$HOME/bin:/usr/local/apache_maven-3.0.4/bin save the file by pressing esc : wq button Note: Don't delete the previous PATH, Just append the M2_HOME path after : Now save and clos...

How ExceptionHandler return JSON in spring MVC

I am working on one project where client/server response is in JSON format. It is easy to send object in JSON format but what if some exception occured and you want to send the Exception also in JSON format ? After n number of trial. I finally able to do the above task .  Step 1 : Add following annotation " AnnotationMethodHandlerExceptionResolver " in your <CONTROLLER>-servlet.xml file. <!-- JSON format support for Exception -->     <bean id="methodHandlerExceptionResolver"         class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver">         <property name="messageConverters">             <list>                 <ref bean="jacksonMessageConverter" />             </list> ...