The project I was originally creating was Spring Boot 1.3.3, Since there was a Spring Framework vulnerability in April, We have decided to upgrade to Spring Boot 1.5.12 corresponding to it.
Of course, simply rewriting the version with pom.xml was not enough, so ... The problems that occurred at that time and how to solve them are listed below.
I used the following two annotations in the test code, With the version upgrade, I got angry that I couldn't find it.
@SpringApplicationConfiguration(classes=MyConfig.class)
@WebIntegrationTest
After investigating, it is said that both will use `` `@ SpringBootTest``` instead on the following page. https://stackoverflow.com/questions/42395225/springapplicationconfiguration-not-found-erroneous-spring-boot-starter-test-con
From @SpringApplicationConfiguration(classes=MyConfig.class) to @SpringBootTest(classes=MyConfig.class) From @WebIntegrationTest to @SpringBootTest(webEnvironment=WebEnvironment.DEFINED_PORT) (or RANDOM_PORT)
I used both this time, so I rewrote it as follows.
@SpringBootTest(classes=MyConfig.class, webEnvironment=WebEnvironment.RANDOM_PORT)
With the above, the error of the test code has been resolved.
# Interface not found error
I was importing the ```EmbeddedServletContainerCustomizer``` interface to display the error screen.
When I build after upgrading, I get angry that I can't find it.
really? I searched for an alternative like the above test code, but I couldn't find it ...
Is it really not there? I thought, and when I searched the hierarchy under ``` spring-boot-1.5.12.RELEASE.jar```,
```embeddedservletcontainercustomizer```The interface file itself existed.
When I try to see the contents on it, the following error occurs and I cannot see the contents.```
java.util.zip.ZipException: invalid LOC header (bad signature)
When I looked it up, it seems that the cause is that the version of the jar file is wrong. As a workaround, delete the following maven repository folder and restart STS.
C: \ Users \ [username] \ .m2 \ repository
This completes the handling of the interface not found error.
Apart from the above two correspondences When I thought about running the project after the version upgrade, The following desperate error occurs.
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at jp.co.ysk.pepper.qlip.App.main(App.java:12)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
I did some research, but I don't know the root cause. For the time being, this error was also resolved by eliminating the two compilation errors.
I feel a little uneasy, but ... That's it.
Recommended Posts