2013-12-08 9 views
26

このチュートリアルの後に、次の依存関係を使用してJettyを実行してspring-bootを起動することができます。しかしspring-bootでのJettyの設定方法(簡単?)

<dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
     <exclusions> 
      <exclusion> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-starter-tomcat</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-actuator</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-jetty</artifactId> 
    </dependency> 

、私のような突堤サーバを設定できる方法:

  1. Serverスレッド(キュースレッドプール)
  2. サーバーコネクタ
  3. HTTPS構成。
  4. これらの設定はすべてJettyで利用できます...?

  1. application.ymlで行う簡単な方法はありますか?
  2. 設定クラス?

いずれの例も高く評価されます。

多くの感謝!

答えて

13

サーブレットコンテナには一般的な拡張ポイントがいくつかあります。また、それらにJetty API呼び出しをプラグインするオプションもあります。一般的なアドバイスはin the docsです。 Jettyはまだ注目を集めていないので、Tomcatと同じように宣言的な設定で利用できるオプションはないかもしれません。あなたがそれを変更するのを手伝いたいなら、助けを歓迎します。誰もが春のブートを使用している場合

+0

ありがとうございました! – Elvin

+0

「pomを追加した後、「埋め込みコンテナを起動できません」というメッセージが表示されます。http://stackoverflow.com/questions/39557018/unable-to-start-embedded-container-after-switch-from-tomcat-to -jetty-spring-bo – Jaskey

+0

私のために働きます。春の起動時にサンプルをチェックしてください。 –

1

可能性がhttp://howtodoinjava.com/spring/spring-boot/configure-jetty-server/

@Bean 
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() { 
    JettyEmbeddedServletContainerFactory jettyContainer = 
     new JettyEmbeddedServletContainerFactory(); 

    jettyContainer.setPort(9000); 
    jettyContainer.setContextPath("/home"); 
    return jettyContainer; 
} 
0

からプログラム的に(部)桟橋を設定するには - あなたが簡単にあなたの中にこれを設定することができますすることはthusly application.properties:N

server.max-http-post-size=n 

このプロパティを設定する最大サイズです。たとえば、私は次のものを使用します:

server.max-http-post-size=5000000 
関連する問題