[英]How to deploy Spring Boot MVC project for others to see?
I've made a spring boot project called student-management using spring MVC, Thymeleaf, spring data JPA and MySql . I've made a spring boot project called student-management using spring MVC, Thymeleaf, spring data JPA and MySql . When I run it locally on localhost:8081 it works perfectly.当我在 localhost:8081 本地运行它时,它运行良好。 I made CRUD operations so I see all the changes in database when changed on the website and vice versa.我进行了 CRUD 操作,因此当在网站上更改时,我可以看到数据库中的所有更改,反之亦然。 Now, I need to get my website "out there" for others to see, specifically a company.现在,我需要将我的网站“公开”出来供其他人查看,尤其是一家公司。 I'm new to Spring boot and everything that goes with it but I don't understand how to deploy my rather simple website so the company can access it by not using localhost.我是 Spring 启动和随之而来的一切的新手,但我不明白如何部署我相当简单的网站,以便公司可以通过不使用本地主机来访问它。
This is my project_hierarchy .这是我的project_hierarchy 。 As you can see it's quite simple.如您所见,它非常简单。
This is my StudentController.java .这是我的StudentController.java 。 I've used @Controller and maybe I should've used @RestController.我用过@Controller,也许我应该用过@RestController。 If so, how do I change it to @RestController so that my website still works.如果是这样,我如何将其更改为 @RestController 以便我的网站仍然有效。
My thymeleaf html files students.html edit_students.html create_student.html My thymeleaf html files students.html edit_students.html create_student.html
Deploying remotely means choosing a host (eg AWS), setting up infrastructure, deploying your executable JAR with dependencies, and running it on a server.远程部署意味着选择主机(例如 AWS)、设置基础设施、部署可执行 JAR 并在服务器上运行它。
You'll need to set up a separate MySQL instance and connect your app to it.您需要设置一个单独的 MySQL 实例并将您的应用程序连接到它。 That means you'll set up the database server, create the database and schema, and start it up before your app starts.这意味着您将设置数据库服务器,创建数据库和模式,并在您的应用程序启动之前启动它。
You should be thinking about security and who should be able to access your app and data.您应该考虑安全性以及谁应该能够访问您的应用程序和数据。 Most developers who have only deployed locally tend to put off those considerations.大多数仅在本地部署的开发人员倾向于推迟这些考虑。 I'd urge you to think about them sooner.我劝你早点考虑一下。
If your purpose is to provide access inside your company, only to employees, perhaps you'd be better off making your local machine available to others on the network OR choose a server that's already on your company network.如果您的目的是仅向员工提供公司内部的访问权限,那么您最好将本地计算机提供给网络上的其他人使用,或者选择公司网络上已经存在的服务器。 You'll have to work with others to make that happen.您必须与他人合作才能实现这一目标。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.