Skip to content

WebServiceTemplateBuilder should prevent the default MessageFactory to be created #48615

@snicoll

Description

@snicoll

Whenever we create a WebServiceTemplate the default strategies are initialized. This can be misleading as it may log some initialization code that doesn't match what you'd be expecting.

For instance, if you want to tune the SOAP version, you'd provide a dedicated WebServiceMessageFactory. However, before you get the chance to do so, the default one is initialized:

2025-12-22T15:56:29.870+01:00  INFO 97248 --- [           main] o.s.ws.soap.saaj.SaajSoapMessageFactory  : Creating SAAJ 1.3 MessageFactory with SOAP 1.2 Protocol
2025-12-22T15:56:35.665+01:00  INFO 97248 --- [           main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2025-12-22T15:56:35.688+01:00  INFO 97248 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat started on port 50035 (http) with context path '/'
2025-12-22T15:56:35.958+01:00  INFO 97248 --- [           main] ingWebServiceApplicationIntegrationTests : Started ProducingWebServiceApplicationIntegrationTests in 15.043 seconds (process running for 15.771)
2025-12-22T16:04:14.305+01:00  INFO 97248 --- [           main] o.s.ws.soap.saaj.SaajSoapMessageFactory  : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol

In the example above, the factory with 1.2 is first created as a bean for reuse and later on a new WebServiceTemplate is created, that logs the default factory, before we get a chance to set it.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions