Closes gh-29278

Added logic to check if target method is ambiguous while generating bean definition method

Please check issue

Comment From: snicoll

Thanks for the PR @Devashish2293 - Unfortunately, not applying the generator in such a case breaks the related bean as it does not have a factory method anymore. See #29278 for more details.