서블릿 startup순서 변경

main
이범준 5 months ago
parent ddd422dcca
commit 9a5b45daa9

@ -0,0 +1,37 @@
package cokr.xit.custom.boot;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;
import cokr.xit.foundation.web.AccessFilter;
@Configuration
public class FilterConfig {
protected static String[] URL_PATTERNS = {"/", "*.do"};
/**CharacterEncodingFilter .
* @return FilterRegistrationBean
*/
@Bean
public FilterRegistrationBean<CharacterEncodingFilter> encodingFilter() {
FilterRegistrationBean<CharacterEncodingFilter> registration = new FilterRegistrationBean<>();
registration.setFilter(new CharacterEncodingFilter("utf-8"));
registration.addUrlPatterns(URL_PATTERNS);
registration.setOrder(-102);
return registration;
}
/**AccessFilter .
* @return FilterRegistrationBean
*/
@Bean
public FilterRegistrationBean<AccessFilter> accessFilter() {
FilterRegistrationBean<AccessFilter> registration = new FilterRegistrationBean<>();
registration.setFilter(new AccessFilter());
registration.addUrlPatterns(URL_PATTERNS);
registration.setOrder(-101);
return registration;
}
}

@ -8,70 +8,45 @@ import org.apache.catalina.webresources.ExtractingRoot;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;
import cokr.xit.foundation.web.AccessFilter;
@Configuration
public class ServletConfig {
protected static String[] URL_PATTERNS = {"/", "*.do"};
@Bean
public ServletRegistrationBean<CXFServlet> cxfServletRegistrationBean() {
ServletRegistrationBean<CXFServlet> bean = new ServletRegistrationBean<>(
new CXFServlet(),
"/lvis/services/*"
);
bean.setLoadOnStartup(2);
return bean;
}
/**DefaultServlet .
* @return ServletRegistrationBean
*/
@Bean
public ServletRegistrationBean<DefaultServlet> defaultServlet() {
public ServletRegistrationBean<DefaultServlet> defaultServletRegistrationBean() {
ServletRegistrationBean<DefaultServlet> bean = new ServletRegistrationBean<>(
new DefaultServlet(),
"/resources/*","/webjars/*"
);
bean.setLoadOnStartup(1);
bean.setLoadOnStartup(3);
bean.setInitParameters(Map.of(
"debug", "0",
"listings", "false"
));
return bean;
}
@Bean
public ServletRegistrationBean<CXFServlet> cxfServlet() {
ServletRegistrationBean<CXFServlet> bean = new ServletRegistrationBean<>(
new CXFServlet(),
"/lvis/services/*"
);
bean.setLoadOnStartup(2);
return bean;
}
/**CharacterEncodingFilter .
* @return FilterRegistrationBean
*/
@Bean
public FilterRegistrationBean<CharacterEncodingFilter> encodingFilter() {
FilterRegistrationBean<CharacterEncodingFilter> registration = new FilterRegistrationBean<>();
registration.setFilter(new CharacterEncodingFilter("utf-8"));
registration.addUrlPatterns(URL_PATTERNS);
registration.setOrder(-102);
return registration;
}
/**AccessFilter .
* @return FilterRegistrationBean
*/
@Bean
public FilterRegistrationBean<AccessFilter> accessFilter() {
FilterRegistrationBean<AccessFilter> registration = new FilterRegistrationBean<>();
registration.setFilter(new AccessFilter());
registration.addUrlPatterns(URL_PATTERNS);
registration.setOrder(-101);
return registration;
}
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> servletContainerCustomizer() {

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package testserver.wsdlserver.lvisserver;
package cokr.xit.custom.boot;
import javax.xml.ws.Endpoint;
@ -26,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import testserver.wsdlserver.lvisserver.CarRegBasicInfoImpl;
@Configuration
public class WebServiceConfig {
@ -37,7 +39,6 @@ public class WebServiceConfig {
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(bus, new CarRegBasicInfoImpl());
endpoint.publish("/WsFrontController");
return endpoint;
}

@ -3,15 +3,14 @@ package cokr.xit.custom.boot;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import testserver.wsdlserver.lvisserver.WebServiceConfig;
@SpringBootApplication
@ImportAutoConfiguration({
CommonConfig.class,
ServletConfig.class,
WebServiceConfig.class,
FilterConfig.class,
MvcConfig.class,
DatasourceConfig.class,
TransactionConfig.class,
WebServiceConfig.class
TransactionConfig.class
})
public class XitApplication {}

@ -33,7 +33,7 @@ import externalsystem.testpool.dao.TestPoolMapper;
@javax.jws.WebService(name = "CarRegBasicInfo", portName = "CarRegBasicInfoPort",serviceName = "CarRegBasicInfoImplService",
targetNamespace = "componentNs:carregbasicinfo.reg.service.lvis/service.reg.CarRegBasicInfo",
endpointInterface = "testserver.wsdlserver.lvisserver.CarRegBasicInfo",
wsdlLocation = "/resources/lvis_service.wsdl"
wsdlLocation = "classpath:lvis_service.wsdl"
)
public class CarRegBasicInfoImpl implements CarRegBasicInfo {

Loading…
Cancel
Save