簡體   English   中英

將Java Web應用程序遷移到Spring Boot嗎?

[英]Migrate java web app to spring boot?

我正在考慮修改現有的Java Web應用程序(帶有web.xml和applicationContext.xml文件以及Spring 2.5)以使用Spring Boot。 這個過程的含義是什么? 我知道我將需要創建一個@Configuration文件來聲明所有bean(以消除applicationContext.xml文件),但是我希望獲得一些更多的見解。 任何建議表示贊賞!

遷移將需要幾個步驟。 他們之中有一些是:-

  1. 將Spring Boot依賴項添加到pom.xml或gradle文件中。
  2. 通過@Bean使用Java配置定義所有XML bean
  3. 如果通過Java配置使用,請定義Spring Security
  4. 將application.properties添加到資源目錄,並定義所有配置值,例如數據庫主機,用戶名,密碼等
  5. 資源/模板中定義您的視圖

您必須包括所有必需的依賴項。 一些依賴項是:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

您可能還會有一些其他依賴項,例如Spring Security。 如果您的應用程序使用Spring Security,則必須為其提供Java配置。 http://www.baeldung.com/spring-boot-security-autoconfiguration

https://spring.io/blog/2014/01/30/migrating-from-spring-framework-3-2-to-4-0-1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM