How to run Spring Boot web application in Eclipse itself?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
You do not need an external application server to run a normal Spring Boot web app from Eclipse. Spring Boot packages an embedded server, so the typical workflow is to import the project, make sure the build tool resolves dependencies, and run the main application class directly inside the IDE.
If that is not working, the problem is usually not how do I deploy this to Eclipse. It is more often a missing JDK, broken Maven or Gradle import, or running the wrong class.
What Eclipse Needs Before You Run
A standard Spring Boot web project needs:
- a supported JDK installed and configured in Eclipse
- a Maven or Gradle project imported successfully
- a main class annotated with
@SpringBootApplication - the web dependency on the classpath, such as
spring-boot-starter-web
In a typical project, the main class looks like this:
That main method is what Eclipse should run.
Import the Project Correctly
If you already have a project, import it as Maven or Gradle rather than as a plain Java folder.
For Maven:
File->ImportExisting Maven Projects- Select the project root containing
pom.xml
For Gradle, use the corresponding Gradle import and wait for dependency resolution to finish before running the app.
If Eclipse shows lots of missing imports, do not try to run yet. Fix the build import first.
Run the Application From Eclipse
Once the project is imported correctly:
- Open the class containing
main. - Right-click the file.
- Choose
Run As->Java Application.
Eclipse starts the Spring Boot process in its console. If the app is a web app and the default configuration is unchanged, it usually starts on port 8080.
You can then open:
If you are using Spring Tools, you may also see a Spring Boot App run option. That is convenient, but plain Java Application is enough for a standard Boot project.
Example Controller to Verify It Works
If you want a minimal web endpoint to confirm the app is running:
Run the application, visit http://localhost:8080, and you should see the response.
Common Configuration Issues
A few setup problems appear repeatedly.
The first is using a JRE instead of a full JDK. Spring Boot projects need a proper Java development kit configured in Eclipse and in the build path.
The second is dependency import failure. If Maven or Gradle has not finished resolving packages, Eclipse may compile partially or not at all. Run a project refresh rather than editing the classpath manually.
The third is choosing the wrong run target. Running a test class or utility class does not start the web server. You must run the @SpringBootApplication main class.
Changing the Port
If port 8080 is already in use, set another port in src/main/resources/application.properties:
Then rerun the application and open http://localhost:9090.
Use DevTools for Faster Iteration
For a smoother local workflow, add Spring Boot DevTools:
That can speed up restarts during local development, though it is optional.
Common Pitfalls
The most common mistake is thinking Eclipse must host the web app like an old servlet container. A normal Spring Boot app runs as a standard Java process with an embedded server.
Another frequent issue is importing the project incorrectly, then chasing missing dependency errors as if they were Spring problems.
People also forget to run the main Boot class and instead run a random Java file. If the console output does not show Spring Boot startup logs, you probably started the wrong class.
Finally, if the app starts and immediately fails, read the Eclipse console carefully. Port conflicts, missing environment variables, and invalid configuration are usually reported there directly.
Summary
- Run a Spring Boot web app in Eclipse by importing it as Maven or Gradle and starting the
@SpringBootApplicationmain class. - You do not need an external Tomcat installation for a normal Boot app.
- Use
Run As->Java Applicationunless your Eclipse setup provides a specific Spring Boot run option. - Fix JDK and dependency-import issues before debugging Spring itself.
- If the server starts, test it in the browser at the configured local port.

