micronaut-projects / micronaut-core

Micronaut Application Framework
http://micronaut.io
Apache License 2.0
6.03k stars 1.05k forks source link

/health returns UP after unrecoverable bean initiation failure #3559

Open pontello opened 4 years ago

pontello commented 4 years ago

In my understanding Micronaut should return unhealthy status after detecting any bean initiation issues. For example, I have a controller that couldn't be created due to a missing property and calls to any endpoint held by that controller always fail with:

io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [my.controller.Name]

It also displays an ERROR message:

[nioEventLoopGroup-2-8] ERROR i.m.h.s.netty.RoutingInBoundHandler - Error writing final response: io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1

I am using micronaut 2.0.0.RC2.

graemerocher commented 4 years ago

This could probably done already with an ExceptionHandler that also implements HealthIndicator

graemerocher commented 4 years ago

Not convinced however we can make a generic solution, maybe an exception handler for all BeanContextException? Will consider it.

pontello commented 4 years ago

True, will take this path.

But it is nice feature to have built in anyway.

Thanks