การ Config แบบนี้จะต้องย้ายพวก filter ออกมาจาก annotation แล้วมา config บน web.xml ให้หมดด้วยครับ ไม่งั้นจะใช้งานไม่ได้ ใน web.xml ผมมีตัวอย่างของการ Config CXF ด้วย ว่าต้องย้ายมาไว้บน web.xml ด้วยไม่งั้นใช้งานไม่ได้
- contextConfigLocation เพื่อไปอ่าน Class ที่ Config ของ SpringBoot เหมือนกับที่ต้อง config บน start-class ที่ใช้บน maven เพื่อให้มันทำานได้
<context-param> <param-name>contextConfigLocation</param-name> <param-value>xxx.Application</param-value> </context-param> <listener> <listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextAttribute</param-name> <param-value>org.springframework.web.context.WebApplicationContext.ROOT </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- Servlet Mapping for CXFServlet --> <servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/soap-api/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>- จะเห็นว่าใช้ org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener ตัวนี้แทนของเดิม
- contextConfigLocation เพื่อไปอ่าน Class ที่ Config ของ SpringBoot เหมือนกับที่ต้อง config บน start-class ที่ใช้บน maven เพื่อให้มันทำานได้