Spring Boot เอา Jetty เป็น embedded server

ทำมาสิบรอบก็ google มาสิบรอบ เลยตัดสินใจเขียน blog นี้ขึ้นมาเผื่อมาใครเจอปัญหาจะได้พอช่วยกันได้ครับ

ปกติ Spring Boot จะ Embedded เจ้า Tomcat ให้เราเป็น ค่า default ไม่รู้ดิ่ครับ ไม่ค่อยชอบ Tomcat ปัญหาเยอะ ชอบ Jetty มากกว่าแค่นั้นเองครับ ก็ไม่มีไรมาก แก้ pom.xml ตามนี้นะครับ

<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-jetty</artifactId>
</dependency>

ง่ายดายไหมครับ

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade