@@ -53,22 +53,14 @@ public class CxfAutoConfiguration {
5353 @ Value ("${cxf.servicelist.title:CXF SpringBoot Starter - service list}" )
5454 private String serviceListTitle ;
5555
56- private String serviceUrlEnding = "" ;
56+ private String serviceUrlEnding = null ;
5757 private Object seiImplementation ;
58- private Service webServiceClient ;
59-
6058
6159 @ Bean
6260 public WebServiceAutoDetector webServiceAutoDetector (ApplicationContext applicationContext ) throws BootStarterCxfException {
6361 return new WebServiceAutoDetector (new WebServiceScanner (), applicationContext );
6462 }
6563
66- @ PostConstruct
67- public void setUp () throws BootStarterCxfException {
68- webServiceClient = webServiceAutoDetector (null ).searchAndInstantiateWebServiceClient ();
69- serviceUrlEnding = "/" + webServiceClient ().getServiceName ().getLocalPart ();
70- }
71-
7264 /**
7365 * We mostly want to autoinitialize the Endpoint and the CXFServlet.
7466 * But when in client mode, this isn´t always wanted (e.g. when you are in Client
@@ -126,7 +118,7 @@ public Endpoint endpoint() throws BootStarterCxfException {
126118 endpoint .setServiceName (webServiceClient ().getServiceName ());
127119 endpoint .setWsdlLocation (webServiceClient ().getWSDLDocumentLocation ().toString ());
128120 if (publishedEndpointUrl .equals ("NOT_SET" )) {
129- endpoint .setPublishedEndpointUrl (webServiceClient .getServiceName ().getLocalPart ());
121+ endpoint .setPublishedEndpointUrl (webServiceClient () .getServiceName ().getLocalPart ());
130122 } else {
131123 endpoint .setPublishedEndpointUrl (publishedEndpointUrl );
132124 }
@@ -138,7 +130,7 @@ public Endpoint endpoint() throws BootStarterCxfException {
138130 @ Bean
139131 public Service webServiceClient () throws BootStarterCxfException {
140132 // Needed for correct ServiceName & WSDLLocation to publish contract first incl. original WSDL
141- return webServiceClient ;
133+ return webServiceAutoDetector ( null ). searchAndInstantiateWebServiceClient () ;
142134 }
143135
144136 /**
@@ -152,7 +144,10 @@ public String baseUrl() {
152144 * @return the concrete Service URL-ending, where the WebService is configured according to your WSDL´s Service Name
153145 * (e.g. "/Weather" when there is this inside your WSDL: <wsdl:service name="Weather">)
154146 */
155- public String serviceUrlEnding () {
147+ public String serviceUrlEnding () throws BootStarterCxfException {
148+ if (serviceUrlEnding == null ) {
149+ serviceUrlEnding = "/" + webServiceClient ().getServiceName ().getLocalPart ();
150+ }
156151 return serviceUrlEnding ;
157152 }
158153
@@ -161,7 +156,7 @@ public String serviceUrlEnding() {
161156 * the concrete Service URL-ending, where the WebService is configured according to your WSDL´s Service Name
162157 * (e.g. "/Weather" when there is this inside your WSDL: <wsdl:service name="Weather">)
163158 */
164- public String baseAndServiceEndingUrl () {
159+ public String baseAndServiceEndingUrl () throws BootStarterCxfException {
165160 return baseUrl () + serviceUrlEnding ();
166161 }
167162
0 commit comments