I have this situation with my code even after I added the @Component, @Service and @Repository annotation to my classes:

this is the resource for it:

package app.gym.v1.Resource.API;

import app.gym.v1.Model.Domain.Gym;
import app.gym.v1.Service.GymService;
import app.gym.v1.Utility.Constant.SwaggerConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static org.springframework.http.HttpStatus.OK;

@RestController
@RequestMapping(path = "/gym")
@Api(tags = {SwaggerConstant.API_TAG3})
public class GymControl {
    private GymService gymService;

    @Autowired
    public GymControl(GymService gymService) {
        this.gymService = gymService;
    }

    @ApiOperation(value = "Get all available gyms", notes = "Retrieve a list of all gyms")
    @ApiResponses({@ApiResponse(responseCode = "200", description = "The list of gyms retrieved"),
            @ApiResponse(responseCode = "400", description = "The request is malformed or invalid"),
            @ApiResponse(responseCode = "404", description = "The resource URL was not found on the server"),
            @ApiResponse(responseCode = "500", description = "An internal server error occurred"),
            @ApiResponse(responseCode = "403", description = "You are not authorized. Please authenticate and try again"),
            @ApiResponse(responseCode = "401", description = "You don't have permission to this resource")
    })
    @GetMapping("/list_gym")
    public ResponseEntity<List<Gym>> getAllGyms() {
        List<Gym> gyms = gymService.getGyms();
        return new ResponseEntity<>(gyms, OK);
    }

    @ApiOperation(value = "Finding gym from list", notes = "Retrieve a gym from the search engine")
    @ApiResponses({@ApiResponse(responseCode = "200", description = "The gym was found"),
            @ApiResponse(responseCode = "400", description = "The request is malformed or invalid"),
            @ApiResponse(responseCode = "404", description = "The resource URL was not found on the server"),
            @ApiResponse(responseCode = "500", description = "An internal server error occurred"),
            @ApiResponse(responseCode = "403", description = "You are not authorized. Please authenticate and try again"),
            @ApiResponse(responseCode = "401", description = "You don't have permission to this resource")
    })
    @GetMapping("/find/{gymName}")
    public ResponseEntity<Gym> getGym(@PathVariable("gymName") String gymName) {
        Gym gym = gymService.findGymByGymName(gymName);
        return new ResponseEntity<>(gym, OK);
    }

}

and this is the repository for it:

package app.gym.v1.Repo;

import app.gym.v1.Model.Domain.Gym;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface GymRepo extends JpaRepository<Gym, Long> {

    Gym findByGymName(String gymName);
}

finally this is the service for it:

package app.gym.v1.Service;

import app.gym.v1.Model.Domain.Gym;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface GymService {

    List<Gym> getGyms();

    Gym findGymByGymName(String gymName);
}

as you see I add all the required annotations but the same bug appear to me

Comment From: bclozel

There might be something else missing. Could you provide a sample application that reproduces the issue? Ideally, something minimal we can git clone and run. Thanks!

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: imjmakki

It's been solved

Comment From: PaoloTiboni

ye how tho ???

Comment From: MoeMoeee

:( how

Comment From: S0ulan

what an idiot...

Comment From: ultraviolet-jordan

what an idiot...

Sir could you explain how you ended up here in the first place....

Comment From: S0ulan

what an idiot...

Sir could you explain how you ended up here in the first place....

google and you?