understands Java, but it knows nothing about Spring. It cannot tell you which classes are beans, which methods answer HTTP requests, or whether spring.jpa.show-sql is a real property. The Spring Boot language server can. It comes from Spring Tools, the same project behind the Spring extension for VS Code, and the spring-boot.nvim plugin runs it inside Neovim next to jdtls.
What the Spring Boot language server adds
The server works in two kinds of files:
- In Java files it finds Spring things: beans, request mappings and the annotations that create them, and offers them as searchable symbols.
- In
application.propertiesandapplication.ymlit knows every Spring Boot property, with its type and documentation. It completes keys, explains them on hover and warns about mistakes.
It also reads pom.xml and reports when a newer Spring Boot version is available, which Part 3 showed in the diagnostics list.
Add the plugin
has no Spring extra, so this is one small file of your own. Plugin files go in lua/plugins/ of your configuration, and lazy.nvim picks them up automatically. The first part asks for the server, which Mason calls vscode-spring-boot-tools; the second loads the plugin for Java and properties files:
{ "mason-org/mason.nvim", opts = { ensure_installed = { "vscode-spring-boot-tools" } } },
{
"JavaHello/spring-boot.nvim",
ft = { "java", "jproperties" },
event = { "BufReadPre application*.yml", "BufReadPre application*.yaml" },
dependencies = { "mfussenegger/nvim-jdtls" },
opts = {},
},
nvim-spring-ide: lua/plugins/spring-boot.lua
The event line matters. Loading the plugin for every YAML file would also start jdtls for Compose and Kubernetes files, which have nothing to do with Java. Limiting it to application*.yml keeps those files light.
The full file has one more piece: it hands the plugin’s Java extension jars to jdtls, so the two servers can share what they know about your classes. Part 15 shows the complete file in a ready-made configuration. The plugin needs Neovim 0.12 or newer.
Restart Neovim and open CatalogController.java from module 9 of the companion code. Press <leader>cl for LSP info: two servers are now attached to the buffer, jdtls and spring-boot.
Find beans and endpoints
The Spring server answers workspace symbol searches that start with a special prefix:
@+lists bean definitions.@/lists request mappings.@alone lists every Spring annotation it found.
The plugin wraps these queries in one command. Run :SpringBoot Beans. In module 9 the list includes catalogController, marked as a @RestController, the productRepository that Spring Data creates for an interface, shopApp and the seed ApplicationRunner defined with @Bean. Run :SpringBoot RequestMappings and the endpoints appear, such as @/catalog -- GET. :SpringBoot without an argument opens a menu of all query types.
Because jdtls imports the whole companion repository, the list covers every module, not only the one you opened. Jump to an entry, or filter the list, to stay in the module you care about.
Complete and check properties
Open src/main/resources/application.properties in module 9. It holds one line:
spring.jpa.show-sql=true
Hover over the key with K. A float shows its type, java.lang.Boolean, its default, false, and one sentence: whether to enable logging of statements.
Now add three lines with mistakes on purpose:
spring.jpa.show-sqll=true
server.port=abc
spring.jpa.op
Leave insert mode and the server reacts to each one. The first gets a warning: ‘spring.jpa.show-sqll’ is an unknown property. Did you mean ‘spring.jpa.show-sql’? The second gets an error, Expecting ‘int’, because a port must be a number. On the third line, the completion menu offers keys that match what you typed, such as spring.jpa.open-in-view and spring.jpa.properties. Delete the three lines when you are done.
The same checks run in application.yml. In our test an unknown key in a YAML file got the same kind of warning as in the properties file.
What it does not do
The Spring server makes beans and properties searchable, but it is not IntelliJ IDEA Ultimate’s Spring support. There is no bean dependency diagram, no gutter icon that jumps from an injection point to the bean it receives, and no endpoint tool window for sending requests. Part 6 compares the two side by side.
Recap
- jdtls knows Java; the Spring Boot language server from Spring Tools knows Spring code and configuration.
spring-boot.nvimruns it next to jdtls; load it for Java, properties andapplication*.ymlfiles only.:SpringBoot Beansand:SpringBoot RequestMappingslist beans and endpoints; they send the@+and@/symbol queries.- In
application.propertiesandapplication.ymlyou get completion, hover documentation and warnings for unknown keys and wrong types.
Series: Neovim as a Java IDE. Previous: Diagnostics and quick fixes for Java in Neovim · Next: Refactoring Java in Neovim
Sources
Official documentation and well-known tutorials read while writing this article. The wording here is our own.
- spring-boot.nvim README
- Spring Tools: Spring Boot Java editor support (symbol search)
- Spring Tools: Spring Boot properties editor support
- Spring Boot reference: Common application properties
- mason-registry: vscode-spring-boot-tools
- Lorenzo Bettini: Neovim and Java with LazyVim, part 2: IDE mechanisms
- Nirmal Ravidas: Setting Up a Full Spring Boot Dev Environment on Linux with Neovim and LazyVim
- Dhruva Sagar: Neovim as a Java IDE
Comments