Java Web 应用程序的 Spring Boot 有哪些缺点?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38633023/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 03:36:16  来源:igfitidea点击:

What are the disadvantages of Spring Boot for Java web applications?

javaspringspring-bootmicroservices

提问by UserF40

[This needs to be voted to be reopened to answer.]

[这需要投票重新打开才能回答。]

Spring boot is tipped as being the default go to when making a new spring application as it makes set up easier and automatically wires in common dependencies.

在创建新的 Spring 应用程序时,Spring Boot 被认为是默认使用的,因为它使设置更容易并自动连接到公共依赖项中。

I am yet in industry to see spring-boot used in the manner advertised.

我还没有在行业中看到以广告方式使用弹簧靴。

Factually and concisely, what are the disadvantages that are faced by developers on adoption of Spring boot as the de facto Spring go to?

事实上,简而言之,开发人员在采用 Spring boot 作为事实上的 Spring 时所面临的缺点是什么?

The advantages of Spring Boot questionshows advantages of which I agree there are many, but believe there should be a rounder view.

Spring Boot问题的优势显示了我同意的优势有很多,但相信应该有一个更全面的看法。

An example non opinion based point would be:

一个非基于意见的观点的例子是:

  • Spring boot may unnecessarily increase the deployment binary size with unused dependencies.

  • Not being able to customize logging easily as shown here.

  • Spring boot 可能会因未使用的依赖项而不必要地增加部署二进制文件的大小。

  • 不能够如图轻松定制的日志记录在此

回答by Grzegorz Gajos

This is a very opinion based question but I believe that the biggest disadvantage that you might encounter is using it or Spring at all without understanding what value it gave to you or your project. It might be completely not aligned with your requirements and it is possible that you will configure everything by yourself at some point.

这是一个非常基于意见的问题,但我相信您可能遇到的最大缺点是在使用它或 Spring 时根本不了解它给您或您的项目带来了什么价值。它可能完全不符合您的要求,并且您可能会在某个时候自己配置所有内容。

Let me comment bullet points that you liked in the question.

让我评论您在问题中喜欢的要点。

  • Create stand-alone Spring applications => You can create standalone java application? Why Spring at the first place?
  • Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files) => What if you have to build war anyway? Little config will do the trick but it's not any major advantage.
  • Provide opinionated 'starter' POMs to simplify your Maven configuration => What if you have many legacy spring modules? What if you need to patch it up?
  • Automatically configure Spring whenever possible => What if this configuration is completely not aligned with your requirements?
  • Provide production-ready features such as metrics, health checks, and externalized configuration => Is it sufficient for you? Is it completely wrong, as you need something more sophisticated? Useless, as you don't need this at all?
  • 创建独立的 Spring 应用程序 => 您可以创建独立的 java 应用程序吗?为什么是春天?
  • 直接嵌入 Tomcat、Jetty 或 Undertow(无需部署 WAR 文件)=> 如果您无论如何都必须构建War怎么办?很少的配置就可以解决问题,但这不是任何主要优势。
  • 提供自以为是的“入门”POM 以简化您的 Maven 配置 => 如果您有许多遗留的 spring 模块怎么办?如果需要修补怎么办?
  • 尽可能自动配置 Spring => 如果此配置完全不符合您的要求怎么办?
  • 提供生产就绪功能,例如指标、健康检查和外部化配置 => 对您来说是否足够?这是完全错误的,因为您需要更复杂的东西吗?没用,因为你根本不需要这个?