Intellij: Go to autowired bean definition

后端 未结 2 712
灰色年华
灰色年华 2021-02-20 05:32

I looking for quick way to find bean definition by their @Autowired dependency in java code. Suppose I have:

@Autowired 
private JdbcTemplate template;


        
相关标签:
2条回答
  • 2021-02-20 05:58

    First install spring plugin by Ctrl+Alt+S under IDE Settings, select Plugins. In the right-hand part of the dialog, on the Plugins page, type spring in the search box. If the check box to the left of Spring Support is not selected, select it. If you are going to use particular Spring frameworks (Spring Security, Spring Integration, etc.), make sure that the check boxes next to their names are also selected.

    Then the icons on the left(near the code line-number) helps to identify the bean definition

    0 讨论(0)
  • 2021-02-20 06:15

    If you have the spring plugin installed and active you should see some icons on the left gutter which help you to identify the place where the bean has been defined, either xml or annotation. If you have multiple spring profiles you may have to chose the active one.

    enter image description here

    0 讨论(0)
提交回复
热议问题