(Beta) Create REST APIs With Spring And Java Skill Path - Spring Project Layout and Running Locally - Help please!

Hello,

I am working through the ‘Create Rest APIs with Spring and Java Skill Path’.

I am at the section ‘Web & Spring Basics > How Spring Works > Spring Project Layout and Running Locally’.

I have followed all the project setup instructions and I encounter the problem at ‘Step 4: Run Project’.

When I run the command given (./mvnw spring-boot:run) I get the following error:

[ERROR] /Users/jenniferopenshaw/projects/mySpringProject/src/main/java/com/example/mySpringProject/controller/HelloController.java:[10,8] class MySpringProjectApplication is public, should be declared in a file named MySpringProjectApplication.java

Can you help? I am sure that earlier in the path we were taught that the class name had to match the filename, but it doesn’t match in the code provided by Codecademy to copy/paste. Could that be the problem? I’ve tried changing the class name to HelloController to match the file name but that didn’t seem to work.

Any help would be very welcome!

Thanks

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.