问题
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 referenced from a method is not visible from class loader
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.mygeneratedclasses=/[packageOfGeneratedClass].class
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.
回答1:
Instead of excluding generated files, you can try to include JAR responsible for loading these classes into restart classloader (used in spring-devtools).
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 issue reference: Devtools cannot be use with jaxws-ri #19379
来源:https://stackoverflow.com/questions/55998022/spring-boot-with-devtools-call-soap-api