Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij: Go to autowired bean definition

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

@Autowired 
private JdbcTemplate template;

I want IDEA tell me in which xml file is the definition of template bean. How to do that?

like image 704
VB_ Avatar asked Jun 27 '14 14:06

VB_


2 Answers

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

like image 192
Morfic Avatar answered Oct 04 '22 12:10

Morfic


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

like image 41
SparkOn Avatar answered Oct 04 '22 12:10

SparkOn