使用devtools的Spring Boot调用SOAP API [英] Spring Boot with devtools call SOAP API
问题描述
我正在使用devtools(spring-boot-devtools)部署一个项目Spring Boot,并调用Soap服务. 我将Soap类生成到/src/main/resources/templates/generated 并将此文件夹添加为源代码. 因为当调用此Soap服务时,它有一个问题:
I am deploy an project Spring Boot, using devtools(spring-boot-devtools) and call a Soap service. I generate the Soap class into /src/main/resources/templates/generated and add this folder as Source Code. Because when call this Soap service, its have a problem:
java.lang.IllegalArgumentException:...从方法引用的ClassV11PortType在类加载器中不可见
java.lang.IllegalArgumentException: ...ClassV11PortType referenced from a method is not visible from class loader
因此,我将spring-devtools.properties文件添加到/src/main/resources/META-INF/spring-devtools.properties 并将此行添加到spring-devtools.properties文件:
So, I was add the spring-devtools.properties file to /src/main/resources/META-INF/spring-devtools.properties and add this line to spring-devtools.properties file:
restart.exclude.mygenicclasses =/ [packageOfGeneratedClass] .class
restart.exclude.mygeneratedclasses=/[packageOfGeneratedClass].class
然后,我可以成功地调用SOAP服务. 但是现在,当我修改一些代码时,我的项目无法自动重新加载. 我试图在任何地方编辑一些代码并保存但不走运,我的项目不会重新加载.
Then now, I can call the SOAP service successful. But now, my project cannot reload automatically when i modified some code. I was try to edit some code anywhere and save but not luck, my project doesnot reload.
推荐答案
您可以尝试包括负责将这些类加载到重启类加载器中的JAR ,而不是排除生成的文件(在spring-devtools中使用) ).
Instead of excluding generated files, you can try to include JAR responsible for loading these classes into restart classloader (used in spring-devtools).
对于依赖项com.sun.xml.ws:jaxws-rt:2.3.2-1
,像这样更新/src/main/resources/META-INF/spring-devtools.properties :
For dependency com.sun.xml.ws:jaxws-rt:2.3.2-1
, update /src/main/resources/META-INF/spring-devtools.properties like this:
restart.include.jax=/jaxws-rt.*\.jar
Github问题参考: Devtools不能与jaxws- ri#19379
Github issue reference: Devtools cannot be use with jaxws-ri #19379
这篇关于使用devtools的Spring Boot调用SOAP API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!