I'm setting up my Neovim with lua and using lazy nvim as my plugin manager. I setup lsp with tsp-zero and try to setup nvim-jdtls, however it only works for the first buffer that I open. Here is the config:
return {
'mfussenegger/nvim-jdtls',
ft = 'java',
config = function ()
local config = {
cmd = { vim.fn.stdpath('data') .. '/mason/bin/jdtls' },
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
}
require('jdtls').start_or_attach(config)
end
}

Found the solution, just move the config part to ~/.config/nvim/ftplugin/java.lua. However still show no filetype and autostart: false