0

i am trying to decalre a spring bean on a xml (Mule config file), and i've created a bean like that:

<bean id="IsActiveFilter" class="com.TimeLineListener.IsActiveFilter">
    <property name="isChatActive" value="${chatListener.isActive}"/>
</bean>

Now, my question is - how can i get tothe value of isChatActive from within the actual bean class? i mean, can i just create a variable (private int isChatActive) with the name isChatActive and it will get whatever value the placeholder gives it? i mean something like:

public class IsActiveFilter{
{ 
private int isChatActive;
}

Will that work? if not, how do i use it?

thanks in advance

Menyh
  • 707
  • 1
  • 10
  • 30

2 Answers2

2

Create a getter and setter and you are fine:

public class IsActiveFilter{

    private int isChatActive;

    public int getIsChatActive() {
        return this.isChatActive;
    }

    public void setIsChatActive(int isChatActive) {
        this.isChatActive = isChatActive;
    }
}
jeha
  • 10,562
  • 5
  • 50
  • 69
1
public class IsActiveFilter {
    private int chatActive;
    public boolean isChatActive() {
        return chatActive;
    }
    public void setChatActive(boolean chatActive) {
        this.chatActive = chatActive;
    }
}
AlexR
  • 114,158
  • 16
  • 130
  • 208