我正在开发SpringBoot应用程序,需要将其部署在运行Windows Server 2012的远程服务器上。我尝试从那里的Eclipse中运行该应用程序,并且可以从服务器本地访问,但是当我尝试从中访问时其他使用服务器IP的设备则没有响应。关于如何部署它的任何想法?该应用程序在端口8080上运行,因此该URL位于本地:localhost:8080 / start / 但是当我访问XXX.XXX.XXX.XXX:8080/access/时,没有答案
我求你了,我很绝望
答案 0 :(得分:0)
当您在eclipse中运行应用程序时,可能会将tomcat配置为侦听structure(list(ID = structure(1:13, .Label = c("a", "b", "c",
"d", "e", "f", "g", "h", "i", "j", "k", "l", "m"), class = "factor"),
rep1 = structure(c(1L, 2L, 2L, 2L, 2L, 1L, 3L, 1L, 1L, 4L,
5L, 1L, 1L), .Label = c("", "a", "f", "k", "l"), class = "factor"),
rep2 = structure(c(1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L,
1L, 1L, 1L), .Label = c("", "b", "l"), class = "factor"),
rep3 = structure(c(1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), .Label = c("", "c"), class = "factor"), rep4 = structure(c(1L,
1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("",
"d"), class = "factor"), value = c(-400L, -300L, -200L, -300L,
-400L, -400L, -400L, -400L, -200L, -300L, -200L, -300L, -300L
)), class = "data.frame", row.names = c(NA, -13L))
,但是,即使您的远程服务器与本地系统位于同一网络中,您也应该能够无故障地访问端点。确保遥控器对公众开放,否则其他设备将无法访问它。
如果您正在使用spring-boot来创建可执行的war或jar以便长期部署到远程服务器,则可以使用springboot本身提供的 Windows服务包装器来注册您的应用程序作为Windows中的服务。
请阅读doc和sample code来实现它。
答案 1 :(得分:-2)
您可能必须在具有@RestController批注的控制器类顶部启用CORS- @ @CrossOrigin