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
To be more specific, I'm referring to Section 4.3 in the "Getting Started" page at docs.spring.io (which is currently making use of Spring 3.0.5. I have OpenJDK 17 and I build using Maven 3.9.1 on Linux Mint 20.3).
The code provided puts the class in the default package (as no other package gets created), and this ends up causing problems because of @SpringBootApplication. Ultimately, the application fails to start after executing mvn spring-boot:run.
The solution is to create a package in MyApplication.java. I would also recommend to move the file from src/main/java/MyApplication.java to src/main/java/com/example/myproject/MyApplication.java to be more consistent with the tip provided in "Developing with Spring Boot" documentation's "Structuring Your Code" section.
To be more specific, I'm referring to Section 4.3 in the "Getting Started" page at docs.spring.io (which is currently making use of Spring 3.0.5. I have OpenJDK 17 and I build using Maven 3.9.1 on Linux Mint 20.3).
The code provided puts the class in the default package (as no other package gets created), and this ends up causing problems because of
@SpringBootApplication
. Ultimately, the application fails to start after executingmvn spring-boot:run
.The solution is to create a package in MyApplication.java. I would also recommend to move the file from
src/main/java/MyApplication.java
tosrc/main/java/com/example/myproject/MyApplication.java
to be more consistent with the tip provided in "Developing with Spring Boot" documentation's "Structuring Your Code" section.The changed code would finally look like this:
The text was updated successfully, but these errors were encountered: