Home > Software design >  NO setter property found in class Spring
NO setter property found in class Spring

Time:03-04

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

applicationContext.xml

  <bean id="jobManager"  p:hostName="${hostName}"
             p:userName="${username}"  p:pWord="${password}">
   </bean>
    

Manager Class

public class JOBManager {
    private String hostName;
    private String userName;
    private String pWord;
    public String getHostName() {
        return hostName;
    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getpWord() {
        return 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

CodePudding user response:

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

  • Related