-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Expected Behavior
When using eagerInitSingletons(true)
, the default Micronaut servlet URL mappings should be set to the value of micronaut.servlet.mapping
.
Actual Behaviour
The default Micronaut servlet URL mappings are left empty, resulting in all requests 404ing.
MicronautServletInitializer.resolveName(BeanIdentifier identifier, BeanDefinition<?> definition)
should be returning "micronaut", which is the @Named
value of DefaultMicronautServlet
, instead it returns defaultMicronautServlet
.
I tested versions 4.5.0-4.12.0 of micronaut-servlet and all are affected.
Steps To Reproduce
- Create a project using
jetty-server
w/ Micronaut Platform version 4.7.6 - Add any controller method, e.g.
@Get("/ping")
- Configure the application to use
eagerInitSingletons(true)
- Attempt to load the /ping endpoint, observe a 404
I did find a workaround. By injecting @Named("micronaut") DefaultMicronautServlet servlet
into a controller, the name resolves correctly in MicronautServletInitializer.resolveName
.
Environment Information
Linux
Java 17
Example Application
https://github.com/greg-esper/micronaut-servlet-eager-init/
Version
Micronaut Platform 4.7.6