在我發佈之前,我已經做了大量的研究,並且想要了解是否應該創建一個新的Spring Boot項目,並使用多主機結構...或者,我應該將當前的Maven多模塊Spring MVC RESTful項目轉換爲Spring Boot。Multi Maven模塊Spring Spring MVC項目到Spring Boot
我們想要一個Spring Boot項目,因爲它可能更容易使用Docker。 我們確實希望在Docker容器中使用Spring MVC RESTful後端,但我們發現的所有示例都涉及使用Spring Boot和Docker。
因此,該項目具有這樣的結構:
parent pom.xml
Entity
- basic Spring Project with Hibernate entities
- has a myproject-entity-context.xml as the Spring application context
- has the database and transactions configured in the context
- translates to a JAR file
- has its own pom.xml and can be built independently
DAO
- basic Spring project with Data Access crud Objects
- has it's own myproject-dao-context.xml file
- inherits from the myproject-entity-context.xml
- pulls in the myproject-entity.jar file in the pom.xml
- translates to a JAR file
- has its own pom.xml so this DAO can be built provided the entity.jar is built
- obviously this layer does all the database work
- very much init tested
Service (Business Services)
- basic Spring project with Transactional Business Services
- one business service can call mutltiple DAO's
- has it's own myproject-service-context.xml file
- inherits from the myproject-dao-context.xml
- pulls in the myproject-dao.jar file in the pom.xml
- translates to a JAR file
- has its own pom.xml so this Service can be built, provided the DAO is built first
- obviously this layer does all the business services work
- very much init tested
Web-Services
- basic Spring Web-App project that compiles to WAR
- has all the Controllers which stores all the endpoints
- has it's own myproject-ws-context.xml file
- inherits from the myproject-service-context.xml
- pulls in the myproject-service.jar file in the pom.xml
- translates to a WAR file
- has its own pom.xml so these Web-Services can be built, provided the myproject-service.JAR is built first
- obviously this layer does all RESTful end-points which call 1 business service
- very much init tested
我們的Spring MVC REST風格的後端還使用了Spring配置文件信封,我們有一個配置文件中讀取一個外部env.properties文件。
我們還使用Spring Security 4.0來保護RESTful端點。
我們想把這個應用程序放在Docker容器中嗎?但所有的文檔都可以在Spring Boot中使用,所以我們可以將Spring Boot添加到這個現有的項目中,但我不知道如何...或者從一個新的Spring Boot項目開始,然後以現有的代碼並將其放入新的Spring Boot項目中。我不是哪個更容易,哪個更難?
我們是否還需要Spring Boot將此應用程序放入Docker容器中?
任何幫助將不勝感激,如果我需要,我可以在這裏添加更多的信息,因爲我需要。
謝謝!
感謝您的幫助。 「你可以遵循許多策略......」不幸的是,我不知道這些策略是什麼,以及這些策略的專業/主要是什麼。我一直在試圖找到一個有文件記錄的地方,而且我沒有太多運氣。所以,我會去當地的一些碼頭聚會上嘗試和更多地瞭解Docker。再次感謝您的幫助。 – tjholmes66