springapplicationcontext

NO setter property found in class Spring


I have a spring application and deploying in external tomcat(version-8.0.0).Using STS ide for development.

applicationContext.xml

  <bean id="Manager" class="com.data.managers.Manager" p:hostName="${hostName}"
             p:userName="${username}"  p:pWord="${password}">
   </bean>
    

Manager Class

public class Manager {

    private String pWord;
    

    public void setpWord(String pWord) {
        this.pWord = pWord;
    }
}

When i build the application,applicationContext file showing error

No setter found for property 'pWord' in class com.data.managers.Manager

what was wrong here.

Help me to solve this issue

thanks in advance


Solution

  • Getter and Setter for pWord should be getPWord() and setPWord(). The first letter after set and get should be uppercase.

    Better change the property to password and getter setter to getPassword and setPassword