What is username and password when starting Spring Boot with Tomcat?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Starting a Spring Boot application with embedded Tomcat does not automatically mean there is a login prompt or a built-in admin account. The answer depends on whether Spring Security is on the classpath and how your application is configured. The important distinction is that Tomcat is the servlet container, while authentication behavior usually comes from Spring Security or your own application code.
Embedded Tomcat Does Not Create App Credentials by Itself
If you run a normal Spring Boot web application with embedded Tomcat and no security configuration, there is no default username and password for your application endpoints.
For example, this application starts an HTTP server, but it does not create any login:
In this case, Tomcat is just hosting the application. It does not invent application credentials for you.
When Spring Security Is Present
If spring-boot-starter-security is on the classpath and you have not defined your own security setup, Spring Boot creates a default in-memory user.
The default values are:
- username:
user - password: a random generated password printed in the application logs at startup
Typical startup output looks like this:
That generated password is intended for development only. It gives you a quick way to log in while building the application, but it should not be relied on for production.
A common source of confusion is blaming Tomcat for these credentials. Tomcat is not choosing them. Spring Boot’s security auto-configuration is.
Set an Explicit Username and Password
If you want stable credentials for local development, define them in configuration:
With those properties, the generated password is replaced by your fixed values.
You can then start the app as usual:
or
At that point the login prompt, if your routes are protected, expects admin and secret123.
Define Your Own Security Configuration
For anything beyond a demo, you should usually provide your own security rules and users. In modern Spring Security, that often means defining a SecurityFilterChain bean.
That replaces the default generated-user behavior with your own application-defined rules.
Do Not Confuse This with Tomcat Manager Credentials
If you deploy a WAR file to a standalone Tomcat server, you may also hear about Tomcat manager credentials stored in tomcat-users.xml. Those credentials are for Tomcat’s administrative applications, not for your Spring Boot application.
That is a different environment from the usual Spring Boot model where Tomcat is embedded inside your executable app.
Common Pitfalls
The most common mistake is assuming embedded Tomcat itself has a default admin login. It does not.
Another mistake is missing the generated Spring Security password in the logs. If logging levels are changed or startup logs scroll past quickly, developers often think the app is broken when the real issue is that the generated password was never copied.
Using the generated password in shared or production environments is also a bad idea. Replace it with explicit configuration or a proper user store.
Finally, make sure you know whether you are dealing with application authentication or Tomcat administration. Those are separate concerns and use different configuration sources.
Summary
- Embedded Tomcat alone does not create a default username and password for your application.
- If Spring Security is on the classpath, Spring Boot creates a default user named
user. - The default password is randomly generated and printed in the startup logs.
- You can override the credentials with
spring.security.user.nameandspring.security.user.password. - For real applications, define your own
SecurityFilterChainand user management instead of relying on defaults.

