Hi All,

I am newbie in the Spring Boot world, I am facing a problem while starting spring boot application below i am sharing some inputs:

@Repository
public interface UserRepository extends ReactiveCrudRepository<User, Long> {}
public interface UserManagementService {
    Mono<ResponseEntity<ApiResponse<String>>> addUser(AddUserRequest request);
}
@Service
@AllArgsConstructor
public class UserServiceImpl implements UserManagementService {
    private UserRepository userRepository;
    private ModelMapper mapper;

//  @Autowired
//  public UserServiceImpl(UserRepository userRepository, ModelMapper mapper) {
//      this.userRepository = userRepository;
//      this.mapper = mapper;
//  }

    @Override
    public Mono<ResponseEntity<ApiResponse<String>>> addUser(AddUserRequest request) {

        String username = request.getUName();
        return userRepository.findByUsername(username).flatMap(existingUser -> {
            ApiResponse<String> response = new ApiResponse<>(MessagesUtils.FAIL,
                    HttpStatus.CONFLICT.value(),
                    MessagesUtils.DUPLICATE_USER);
            return Mono.just(ResponseEntity.status(HttpStatus.OK).body(response));
        }).switchIfEmpty(saveNewUser(request));

    }

    private Mono<ResponseEntity<ApiResponse<String>>> saveNewUser(AddUserRequest request) {
        return userRepository.save(User.builder().uRole(request.getURole()).uName(request.getUName()).build())
                .flatMap(savedUser -> {
                    ApiResponse<String> response = new ApiResponse<>(MessagesUtils.SUCCESS, 
                            HttpStatus.CREATED.value(),
                            MessagesUtils.USER_ADDED_SUCCESSFULLY);
                    return Mono.just(ResponseEntity.status(HttpStatus.CREATED).body(response));
                });
    }

}
@RestController
@RequestMapping("/api/users")
@AllArgsConstructor
public class UserController {

    private UserManagementService userManagementService;

//  public UserController(UserManagementService userManagementService) {
//      this.userManagementService = userManagementService;
//  }

    @PostMapping()
    public Mono<ResponseEntity<ApiResponse<String>>> addUser(@RequestBody AddUserRequest addUserRequest){
        return userManagementService.addUser(addUserRequest);
    }
}

Error:

APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.kadir.abdul.twitter.service.Impl.UserServiceImpl required a bean of type 'com.kadir.abdul.twitter.repository.UserRepository' that could not be found.


Action:

Consider defining a bean of type 'com.kadir.abdul.twitter.repository.UserRepository' in your configuration.

Comment From: bclozel

Thanks for getting in touch, but it feels like this is a question that would be better suited to StackOverflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

Comment From: AbdulKadir100

Hi team,

Got your point.

Thanks and Regards, Abdul Kadir

On Wed, Apr 10, 2024, 5:31 PM Brian Clozel @.***> wrote:

Closed #40291 https://github.com/spring-projects/spring-boot/issues/40291 as not planned.

— Reply to this email directly, view it on GitHub https://github.com/spring-projects/spring-boot/issues/40291#event-12420842905, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMTQ2KXI3W2N66LZOW5KPTDY4USZ7AVCNFSM6AAAAABGAIOT4SVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSGQZDAOBUGI4TANI . You are receiving this because you authored the thread.Message ID: @.*** com>