```
@Bean
public Session session(){
    SessionConnector connector=new SessionConnector(url,username,password,environment);
    Session session= connector.getSession();
    session.registerListener(listener());

    return session;
}
@Bean
public Listener listener(){
   return new Listener(session())
}

```

I have the code above which ends up running an endless loop...How can I separate the registration of the listener into a separate method? (I tried creating a temporary private Session bean without the registration code but for some reason you cant have private beans?)

Thxs.