Integrate some features from the VScode Spring Boot plugin into Neovim
.
- Find Beans annotated with
Spring
. - Find Web Endpoints.
- Autocompletion and navigation for
application.properties
andapplication.yml
files. - Code snippet completion.
-
Code Action
.
lazy.nvim
{ "JavaHello/spring-boot.nvim", ft = "java", dependencies = { "mfussenegger/nvim-jdtls", -- or nvim-java, nvim-lspconfig "ibhagwan/fzf-lua", -- optional }, }
- Optionally, install VScode Spring Boot in Visual Studio Code.
require('spring_boot').setup({})
- Default configuration
vim.g.spring_boot = { jdt_extensions_path = nil, -- defaults to ~/.vscode/extensions/vmware.vscode-spring-boot-x.xx.x jdt_extensions_jars = { "io.projectreactor.reactor-core.jar", "org.reactivestreams.reactive-streams.jar", "jdt-ls-commons.jar", "jdt-ls-extension.jar", }, } require('spring_boot').setup({ ls_path = nil, -- defaults to ~/.vscode/extensions/vmware.vscode-spring-boot-x.xx.x jdtls_name = "jdtls", log_file = nil, java_cmd = nil, -- by default will try to get java 17+ path by using JAVA_HOME. If set, this will use the value here as the java command })
For detailed configuration, refer to the nvim-jdtls project.
local jdtls_config = {
bundles = {}
}
-- Add spring-boot jdtls extension jar files
vim.list_extend(jdtls_config.bundles, require("spring_boot").java_extensions())
require('spring_boot').init_lsp_commands()
require("lspconfig").jdtls.setup {
init_options = {
bundles = require("spring_boot").java_extensions(),
},
}