最近我决定使用pass from Eclipse to VS Code
,一切顺利进行Javascript开发但是对于Spring Boot
应用程序我不知道如何在这里配置它们。
除了application.properties
文件,我有一个额外的local.properties
,我用它来本地运行Spring Boot应用程序。
我看到有一个launch.json
文件:
{
"configurations": [
{
"type": "java",
"name": "CodeLens (Launch) - fmApplication",
"request": "launch",
"mainClass": "com.application.zz.app.fmApplication",
"projectName": "file-manager"
}
]
}
在Eclipse中,我添加了额外的配置来运行我的Spring Boot Application,如下所示:
我怎么能这样做是代码:)?
与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"
}
]
}