You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No idea why this happens and the errors are sort of sporadic. either it won't start the app or it'll refuse to recompile things. I don't know. In all instances adding public to the class cntainign the main method fixes it. My ask is that either Devtools handles non public main classes or that the generated code on the Spring Initializr not generate classes that are packae private
The text was updated successfully, but these errors were encountered:
wilkinsona
changed the title
devtools fails when running against a main method in the test code (such as when using Testcontainers) when the class containing the method isn't public
Devtools does not support package-private main classes
Jun 13, 2023
The problem seems to be specific to Devtools as a package-private main class with a public main method can be launched in an IDE and can also be launched using java -jar.
org.springframework.boot.devtools.restart.MainMethod finds the main method on the package-private class but org.springframework.boot.devtools.restart.RestartLauncher cannot invoke it. For consistency, the method should be made accessible as org.springframework.boot.loader.MainMethodRunner already does.
No idea why this happens and the errors are sort of sporadic. either it won't start the app or it'll refuse to recompile things. I don't know. In all instances adding
public
to the class cntainign themain
method fixes it. My ask is that either Devtools handles nonpublic
main classes or that the generated code on the Spring Initializr not generate classes that are packae privateThe text was updated successfully, but these errors were encountered: