【问题标题】:Spring-boot, tomcat-embedded -- how define catalina.properties?Spring-boot,tomcat-embedded——如何定义catalina.properties?
【发布时间】:2017-11-06 20:05:26
【问题描述】:

当运行带有tomcat-embedded的spring-boot时, 如何设置/更改这些 tomcat-config 系统属性?

我尝试在命令行中添加 -D...,但似乎不起作用。

【问题讨论】:

标签: tomcat spring-boot catalina embedded-tomcat-8


【解决方案1】:

我目前正在启动我的 spring-boot 应用程序时通过命令行定义 catalina.properties 之一。

我们要添加的属性是:tomcat.util.http.parser.HttpParser.requestTargetAllow

我用来运行应用程序的完整命令是:

mvn -Dtomcat.util.http.parser.HttpParser.requestTargetAllow={} spring-boot:run

您应该能够附加更多的 catalina 属性,如下所示:

mvn -Dtomcat.util.buf.StringCache.byte.enabled=true -Dtomcat.util.http.parser.HttpParser.requestTargetAllow={} spring-boot:run

您可以添加您在此处提到的任何属性: https://tomcat.apache.org/tomcat-8.5-doc/config/systemprops.html

在以下帖子的帮助下,我最终得到了这个解决方案:

https://bz.apache.org/bugzilla/show_bug.cgi?id=60594

Invalid character found in the request target in spring boot

让我知道它是否适合你。

【讨论】:

    【解决方案2】:

    我将 -D 属性放在 .conf 中,如下所示:

    JAVA_OPTS="$JAVA_OPTS -Dtomcat.util.http.parser.HttpParser.requestTargetAllow={}

    这就是您为部署所做的方式,Alvaro Lazaro 的 maven 风格更多地用于开发目的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-28
      • 2018-05-12
      • 2018-12-20
      • 1970-01-01
      • 2016-12-01
      • 2018-04-02
      • 1970-01-01
      • 2015-02-03
      相关资源
      最近更新 更多