gpt4 book ai didi

spring - Visual Studio代码+ Spring Boot项目更改spring.properties.additional-location等

转载 作者:行者123 更新时间:2023-12-03 15:59:25 25 4
gpt4 key购买 nike

最近我决定使用pass from Eclipse to VS Code,对于Javascript开发来说一切都运行顺利,但是对于Spring Boot应用程序我不知道如何在这里配置它们。

除了application.properties文件之外,我还有另外一个local.properties,可用于在本地运行Spring Boot Application。

我看到有一个launch.json文件:

{
"configurations": [

{
"type": "java",
"name": "CodeLens (Launch) - fmApplication",
"request": "launch",
"mainClass": "com.application.zz.app.fmApplication",
"projectName": "file-manager"
}
]
}

在Eclipse中,我正在添加其他配置来运行我的Spring Boot Application,如下所示:

enter image description here

Vs Code :)我该怎么办?

Here is the issue on Vs Code Github Page

最佳答案

与JavaScript不同,Java代码需要进行编译,因此它只是可视化的文本编辑器,因此无法与Visual Studio代码一起使用,即开即用。

但是,有多种工具可以适应这种情况,VS代码的人们
有一个很好的指南来设置您-https://code.visualstudio.com/docs/java/java-spring-boot

解决方案:

因此,您有一个application.properties文件,在本地有一个application-local.properties(注意,必须像这样命名您的本地属性)。

然后在launch.json中将其添加到程序参数中:
"args": "--spring.profiles.active=local"
因此,您的launch.json文件将如下所示:

{
"configurations": [
{
"type": "java",
"name": "CodeLens (Launch) - fmApplication",
"request": "launch",
"mainClass": "com.intralot.l10.app.fmApplication",
"projectName": "file-manager",
"args": "--spring.profiles.active=local"
}
]
}

关于spring - Visual Studio代码+ Spring Boot项目更改spring.properties.additional-location等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54901961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com