繁体   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