- Problems encountered:
Springboot the heat deployment in the project raises the lesson of the blood, error code location:
1new XStream (); 2 xstream1.autodetectannotations (true); 3 xstream1.alias ("interboss", Interbossheader. Class); 4 Interbossheader resp = (interbossheader) xstream1.fromxml (response);
The POM configuration in the project:
1 <Dependency>2 <groupId>Org.springframework.boot</groupId>3 <Artifactid>Spring-boot-devtools</Artifactid>4 <Scope>Runtime</Scope>5 </dependency>
- Analysis of the problem:
The above configuration found that the same type (Interbossheader) unexpectedly occurred type conversion exception! wqnmmp-. —
In order to implement a class loader to load the class that will change in the project, Spring's Dev-tools implements a classloader for the classloader of the different types of conversion exceptions, so that the new changes will be updated in the event of a reboot. In fact, there are some official documents in the description:
1By default, any open project in your IDE would be loaded using the2"Restart" ClassLoader, and any regular. jar file would be loaded using3The "base" ClassLoader. If you work in a multi-module project, and not4Each module was imported into the your IDE, you could need to customize5Things. To does this can create a6Meta-inf/spring-devtools.properties file.7The Spring-devtools.properties file can contain restart.exclude. and8Restart.include. Prefixed properties. The Include elements are items9That should is pulled up into the "restart" ClassLoader, and theTenExclude elements is items that should is pushed down into the "base" OneClassLoader. The value of the property was a regex pattern that would be AApplied to the classpath.
- Workaround:
The first solution: Create the Meta_inf folder under the Resources directory, and then create the Spring-devtools.properties file with a configuration similar to the following:
Restart.exclude.companycommonlibs=/mycorp-common-[\w-]+.jar
Restart.include.projectcommon=/mycorp-myproj-[\w-]+.jar
Second solution: Do not use Spring-boot-devtools (when I did not say)
Reference: Test water connection
Springboot type conversion exceptions caused by using Devtools