There is some bin
@Repository @Transactional public class UserServiceImpl implements UserService { ... } It must be called in another method that creates new threads:
@Autowired UserService userService; new Thread(new NewClientsThread(new Runnable(){ @Override public void run() { //Здесь вызывается userService } })).start(); But when working at the time of accessing the bin, I get a NullPointerException. I understand that the context of the spring is not available in the new stream.
Are there any ways to overcome this problem?