@Test public void deleteUser() { testSubject.deleteUser("Demo"); assertTrue(users.isEmpty()); }
@Transactional public void deleteUser(String username) { synchronized (userRepository) { userRepository.findById(username).ifPresent(u -> { userRepository.delete(u); userRepository.flush(); }); } }
UserController { @Transactional public void deleteUser(String username) { synchronized (userRepository) { userRepository.findById(username).ifPresent(u -> { userRepository.delete(u); userRepository.flush(); }); } } }
UserController { @Transactional public void deleteUser(String username) { synchronized (userRepository) { userRepository.findById(username).ifPresent(u -> { userRepository.delete(u); userRepository.flush(); }); } } UserController(PasswordEncoder passwordEncoder, UserRepository userRepository); }
UserController { @Transactional public void deleteUser(String username) { synchronized (userRepository) { userRepository.findById(username).ifPresent(u -> { userRepository.delete(u); userRepository.flush(); }); } } UserController(PasswordEncoder passwordEncoder, UserRepository userRepository); @Transactional void deleteUser(String username); List<User> getUsers(); @Transactional User updateUser(String username, String password, Set<UserRole> roles); @Transactional void syncUser(User jpaUser); String getPassword(String userName); User findUser(String name); @Transactional void removeRolesForContext(String context); @Transactional void deleteAll(); }
UserController { @Transactional public void deleteUser(String username) { synchronized (userRepository) { userRepository.findById(username).ifPresent(u -> { userRepository.delete(u); userRepository.flush(); }); } } UserController(PasswordEncoder passwordEncoder, UserRepository userRepository); @Transactional void deleteUser(String username); List<User> getUsers(); @Transactional User updateUser(String username, String password, Set<UserRole> roles); @Transactional void syncUser(User jpaUser); String getPassword(String userName); User findUser(String name); @Transactional void removeRolesForContext(String context); @Transactional void deleteAll();  }