1 Reply Latest reply on Dec 4, 2012 10:16 PM by EJP

    method in a class that should not be visible to outside class

      I am using Spring task executor and I have a service that has two method.

      public SpringTaskExecutor implement SpringExecutor {
      List<Info> infos;

      //called by spring to poll the db after every 10 mts
      public pollDatabaseAfterEveryTenMinute(){
      .infos= new ArrayList<Info>();

      //called by other class to get polling details
      public List<Infor> getInfoOfTeam(){
      return infos;


      But I want to make pollDatabaseAfterEveryTenMinute as private or protected so that only Spring can call it ,but no one else.

      Unfortunately I cannot make it private/protected because I implement an interface and spring will not find if I dont define the method in the interface.The second alternative is not to implement the interface.
      Please tell me if I have any other alternative