Which of the following annotations is specifically used for injecting dependencies on setter methods?

  • @Inject
  • @Autowired
  • @Resource
  • @Setter
Among the provided options, the @Autowired annotation is specifically used for injecting dependencies on setter methods in Spring. When you apply @Autowired to a setter method, Spring will automatically inject the required dependencies into that setter method. The other annotations have different purposes, such as @Inject and @Resource are more generic dependency injection annotations, and @Setter is not a standard Spring annotation for dependency injection.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *