Apache Maven Installation and Maven Configuration

Maven : Apache Maven is a basically used for managing project's build, reporting and documentation. Maven is based on model which is called POM(Project Object Model).

Installation :

1. Download Maven from http://maven.apache.org/download.html eg.version Maven 3.0.4
2. unzip into any Directory. ex. C:\Program Files\apache-maven-3.0.4(Windows) or /usr/local/apache-maven/apache-maven-3.0.4(Unix)
3. Add Environment variable M2_HOME = <Installation dir without bin directory> or export M2_HOME = <path of installed without bin>
4. append %M2_HOME%\bin into PATH Environment
Unix : export M2=$M2_HOME/bin and export PATH=$M2:$PATH
6. Optional – add the environment variable MAVEN_OPTS to specify JVM properties, e.g.
Windows : MAVEN_OPTS = -Xms256m -Xmx512m
Unix : export MAVEN_OPTS=”-Xms256m -Xmx512m”
5. goto cmd and check Maven as : mvn -version

Deep Dive into Spring Setter Injection

Spring setter injection provide you to set value of different types of Data which you use while developing application. If you are not aware of Constructor or Setter Injection concept, please refer Spring Setter Injection and Constructor Injection before going through tutorial.

I will show you how to use it Spring setter Injection for different types of data.somehow due to formatting String is displayed as string.please use String in your example.

1. Create PropertyTest.java
package com.anuj.spring.core.injection;

import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 *
 * @author Anuj J Patel
 */
public class PropertyTest {
    
    private int intData;
    private double doubleData;
    private float floatData;
    private String stringData;
    private int[] intArr;
    private String[] stringArr;
    private List listdata;
    private Map map;
    private Properties properties;
    private Set setData;

    public PropertyTest() {
        System.out.println("Constructor Called");
    }
    
    @Override
    public String toString() {
        return "PropertyTest{" + "intData=" + intData + ", doubleData=" + doubleData + ", floatData=" + floatData + ", stringData=" + stringData + ", intArr=" + intArr + ", stringArr=" + stringArr + ", listdata=" + listdata + ", map=" + map + ", properties=" + properties + ", setData=" + setData + '}';
    }
    
    public double getDoubleData() {
        return doubleData;
    }

    public void setDoubleData(double doubleData) {
        this.doubleData = doubleData;
    }

    public float getFloatData() {
        return floatData;
    }

    public void setFloatData(float floatData) {
        this.floatData = floatData;
    }

    public int[] getIntArr() {
        return intArr;
    }

    public void setIntArr(int[] intArr) {
        this.intArr = intArr;
    }

    public int getIntData() {
        return intData;
    }

    public void setIntData(int intData) {
        this.intData = intData;
    }

    public List getListdata() {
        return listdata;
    }

    public void setListdata(List listdata) {
        this.listdata = listdata;
    }

    public Map getMap() {
        return map;
    }

    public void setMap(Map map) {
        this.map = map;
    }

    public Properties getProperties() {
        return properties;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    public Set getSetData() {
        return setData;
    }

    public void setSetData(Set setData) {
        this.setData = setData;
    }

    public String[] getStringArr() {
        return stringArr;
    }

    public void setStringArr(String[] stringArr) {
        this.stringArr = stringArr;
    }

    public String getStringData() {
        return stringData;
    }

    public void setStringData(String stringData) {
        this.stringData = stringData;
    }
}