I am running a maven clean package:
1) The development profile has LDAP health-check deactivated:
Nevertheless I have the following error:
2) I have even coded a custom LDAP configuration BUT it doesn't seem to be taken into account by the LDAP health-check ( whereas my real code works fine and doesn't face the same LDAP issue when making LDAP requests at runtime)
Regards
Comment From: semangard
Sorry I still have the issue.
Comment From: snicoll
Sorry but we can't really figure out what is going on based on screenshots. The configuration key you highlight is correct but that doesn't mean that Spring Boot read it. If you want support, please take the time to create a small sample that we can run ourselves. You can share it with us as a zip attached to this issue or by providing a link to a GitHub repo.
Comment From: onobc
@semangard
If you want some tips on how to debug it yourself, here is what I would do...
-
Verify that the properties in
application-development.yml
are in fact being used. There is a good chance they are not since the health indicator has a property based guard onmanagement.health.ldap.enabled
. Just put a debugger on the app and set a breakpoint and inspect the environment.```java @Autowired private Environment env;
@PostConstruct void init() { System.out.println("**** Hi - put a breakpoint here and scan through env a bit"); } ```
-
Verify that the user-configured
ContextSource
(the one in your screenshot) is/not being used by the auto-config when it creates the LdapTemplate: - Set a breakpoint in your user-configured
ContextSource
bean definition method - Set a breakpoint on the auto-configured LdapContextSource
- Set a breakpoint on the auto-configured LdapTemplate.java#71
By stepping through the app startup you should be able to answer the following:
* Is your user-configured ContextSource being created? Is it being used in the LdapTemplate?
* Is the auto-configured LdapContextSource being created? Is it being used in the LdapTemplate?
* Notice that your bean is of type ContextSource
and the auto-configured one is LdapContextSource
. What happens if you change your signature to LdapContextSource
?
Almost all of the details I have learned about the framework is by attaching a debugger. That is what demystifies the magic. :)
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: semangard
Thanks, I got in fact an issue with the spring profile used by maven during tests. It is solved : management.health.ldap.enabled=false is correctly taken into account now.
Comment From: snicoll
Thanks for following up.