Skip to content

Navigation

Martin Lippert edited this page Jan 22, 2019 · 17 revisions

Go to symbol in file/project/workspace

Easy navigation to Spring-specific elements of your source code.

Shortcuts

  • Eclipse: Cmd-6 (symbols in workspace), Cmd-6 again (symbols in project, new in 4.1.1), Cmd-6 again (symbols in file)
  • Code: Cmd-Shift-O (symbols in file), Cmd-T (symbols in workspace)
  • Atom: not available yet (symbols in file show up in outline view)

Use Ctrl on windows/linux in place of Cmd key.

Annotations

All Spring annotations from the source code in the workspace are in the list of symbols. They are prefixed with @ as the other Spring symbols. It is best to type a specific annotation such as @Autowired in the search box to narrow down the list of symbols to specific type of annotation being searched for. The annotation synbol entry in the list consits of:

  • Annotation label (i.e. @Autowired, @Qualifier etc.)
  • Path to the resource containing the annotation symbol

Clicking on the annotation entry in the list navigates to the position in the source code resource where the annotation is located

Beans

All Beans symbols are prefixed with @+. Typing @+ is the search box lists only Bean symbols defined in the source code.

A common bean entry defined with an annotation consists of:

  • Bean ID
  • Annotation label including annotation "Meta Inheritance Relationship", i.e. any Controller is a Component
  • Path to the resource containing the bean definition

There are bean definitions without annotations such as Spring Data Repository beans. These consist of:

  • Bean ID
  • Type of model objects stored by the repository and Java type of the repository
  • Path to the resource containing the bean definition

Clicking on the bean entry in the list navigates to the position in the source code resource where the bean is defined.

Bean definitions from Spring XML config files

As with version 4.1.1 the Spring Tools 4 are able to parse Spring XML config files for bean definitions. Therefore all XML files in the workspace are scanned and analyzed for Spring bean definitions. At the moment only direct bean definitions in the style of:

    <bean id="name" class="org.test.TheClassOfTheBean"/>

As a result, a bean symbol in generated and showing up in the list of symbols as: @+ 'name' TheClassOfTheBean.

Since this is an experimental feature, you need to enable it via the preferences first, and restart the tooling afterwards in order to trigger the initial scanning of Spring XML config files.

Request Mappings

All Request Mapping symbols are prefixed with @/. Typing @/ in the search box lists only Request Mapping symbols.

A common Request Mapping symbol entry consists of:

  • Path of the Request Mapping
  • Type of the RequestMapping or content type or other auxiliary data if applicable
  • Path to the resource containing the bean definition

Clicking on the Request Mapping entry in the list navigates to the position in the source code resource where the Request Mapping is defined.

Examples

  • @/ shows all defined request mappings (mapped path, request method, source location)
  • @+ shows all defined beans (bean name, bean type, source location)
  • @> shows all functions (prototype implementation) (see the Spring Cloud Function project)
  • @ shows all Spring annotations in the code
  • // shows all request mappings of all running Spring Boot apps and opens a browser for the selected endpoint (this only works in the global 'go to symbol' view - after pressing Cmd-6 twice)

Clone this wiki locally