Container does not create beans Java EE

62 views Asked by At

I use: GlassFish 6.2.5 openjdk-18 java ee 8.0.1

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/api")
public class RestConfig extends Application {}

Here is my REST controller:

@Path("/sneakers")
public class RestSneakersController implements SneakersController {
    @Override
    @GET
    @Path("/findOne/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Sneakers getSneakers(@PathParam("id") long id) {
        return dao.findOne(id);
    }
}

When I access his method via an http request, I get a 404 in response.

I checked whether the beans are being created by writing a message that should be output when an empty constructor is triggered.

public RestSneakersController() {
    System.out.println("!!!!!!CREATED!!!!!!!");
}

It is not output. From which I concluded that the bean is not being created. I have the same problem with Tomcat and JBoss. At the same time, there are no problems in the logs. I've been standing in the same place for a week now and I can't solve this problem in any way. The only hope is for you. Please help me. Here is the link to git

0

There are 0 answers