We have to add native hints in order to make spring-security-ldap work in native applications. It would look something like this.

@NativeHint(trigger = LdapUserDetails.class,
        types = @TypeHint(typeNames = "com.sun.jndi.ldap.LdapCtxFactory"),
        resources = @ResourceHint(patterns = ".*.ldif")
)
public class LdapSecurityHints implements NativeConfiguration {
}