Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Missing hints for health indicators #1183

Closed
olivierboudet opened this issue Oct 24, 2021 · 7 comments
Closed

Missing hints for health indicators #1183

olivierboudet opened this issue Oct 24, 2021 · 7 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@olivierboudet
Copy link
Contributor

Hello,

I am using spring native 0.11.0-SNAPSHOT (sha1 78bfed5) with Spring Boot 2.6.0-RC1.
I have following gradle dependencies :

implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'

It builds fine but I have an error at runtime :

2021-10-24 19:55:20.628 ERROR 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Native reflection configuration for org.springframework.boot.actuate.mongo.MongoHealthIndicator.<init>(org.springframework.data.mongodb.core.MongoTemplate) is missing.

Action:

Native configuration for a method accessed reflectively is likely missing.
You can try to configure native hints in order to specify it explicitly.
See https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#native-hints for more details.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 24, 2021
@snicoll
Copy link
Contributor

snicoll commented Oct 26, 2021

Closing in favor of PR #1184

@snicoll snicoll closed this as completed Oct 26, 2021
@snicoll snicoll added status: superseded An issue that has been superseded by another and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 26, 2021
@olivierboudet
Copy link
Contributor Author

Sorry @snicoll but is this possible to reopen this issue ? It is not working with the current mainsnapshot, I think the polishing broke something.
You can reproduce the issue with this repo : https://github.com/olivierboudet/spring-native-demo
I always have the error when running the application :

Native reflection configuration for org.springframework.boot.actuate.mongo.MongoHealthIndicator.<init>(org.springframework.data.mongodb.core.MongoTemplate) is missing.

@snicoll
Copy link
Contributor

snicoll commented Oct 31, 2021

Alright, It is probably registered but with the wrong type.

@snicoll snicoll reopened this Oct 31, 2021
@snicoll snicoll added theme: aot type: bug A general bug and removed status: superseded An issue that has been superseded by another labels Oct 31, 2021
@snicoll snicoll added this to the 0.11.0-M2 milestone Oct 31, 2021
@snicoll snicoll self-assigned this Oct 31, 2021
@sdeleuze sdeleuze modified the milestones: 0.11.0-M2, 0.11.0-RC1 Nov 2, 2021
@olivierboudet
Copy link
Contributor Author

Alright, It is probably registered but with the wrong type.

yep it seems to be registered just as Object (ie. beanFactory.getBeanDefinition(beanName).getResolvableType().toClass(); returns Object).
The only solution I found to have the correct type is to use beanFactory.getBean(beanName).getClass();.

@snicoll
Copy link
Contributor

snicoll commented Nov 3, 2021

The only solution I found to have the correct type is to use beanFactory.getBean(beanName).getClass();.

You can't do that as it instantiates the bean and we can't do that at build time. I'll have a look shortly.

@snicoll snicoll modified the milestones: 0.11.0-RC1, 0.11.0-M2 Nov 3, 2021
@snicoll
Copy link
Contributor

snicoll commented Nov 3, 2021

The problem is the composite pattern in Spring Boot returns either a composite of T or T if there is only one instance. Because a single method is doing both, the return type is HealthContributor, hiding the actual type that the composite is going to use via reflection.

We'll have to inspect things a bit more to get back the actual type.

@snicoll snicoll closed this as completed in 3805356 Nov 3, 2021
@olivierboudet
Copy link
Contributor Author

Thank you ! I will test it soon :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A general bug
Development

Successfully merging a pull request may close this issue.

4 participants