Skip to content

Latest commit

 

History

History
82 lines (67 loc) · 2.25 KB

README_en.md

File metadata and controls

82 lines (67 loc) · 2.25 KB

Spring Boot Nvim

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 and application.yml files.
  • Code snippet completion.
  • Code Action.

Installation

  • 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.

Configuration

spring-boot.nvim

  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
      })

nvim-jdtls

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())

nvim-lspconfig

require('spring_boot').init_lsp_commands()
require("lspconfig").jdtls.setup {
  init_options = {
    bundles = require("spring_boot").java_extensions(),
  },
}

Usage

  • Find Beans annotated with Spring.
    :FzfLua lsp_live_workspace_symbols
    lsp_live_workspace_symbols