The log “Using generated security password:” appears in the startup of the spring boot application. This log is due to default security configuration. This can be disabled, removed or customized using configurations.

If the spring boot security dependency is added to pom.xml, the security authentication of the spring boot application is enabled by default. It shows with a generated password as below

2020-01-30 17:48:49.753  INFO 73579 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-01-30 17:48:49.898  INFO 73579 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 

Using generated security password: c581c5eb-8905-4461-9c70-ebb09e3a6950

2020-01-30 17:48:49.960  INFO 73579 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [,,,,,,,,,,,,,,]
2020-01-30 17:48:50.021  INFO 73579 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''

Root Cause

The log “Using generated security password: c581c5eb-8905-4461-9c70-ebb09e3a6950” appears at startup due to security feature is enabled in your spring boot application. The spring boot security dependency “spring-boot-starter-security” is added in the pom.xml file and default security configurations are not configured or customized in the application.

How to reproduce this issue

In the spring boot application pom.xml file, add the spring boot security dependency, and restart the spring boot application. You can see the log message in the console at startup.



what is default username and password for spring boot security?

As specified in Spring Boot Reference documentation in the Security section, The default username is “user” and default password is generated password displayed in the console log at startup

The default AuthenticationManager has a single user (‘user’ username and random password, printed at INFO level when the application starts up)

Using default security password: 78fa095d-3f4c-48b1-ad50-e24c31d5cf35
username : user
password : <security password shown in console log>

How to change default username and password for spring boot security?

The default username and password can be changed using configurations in the file. There are two pre-defined properties available to change the username and password. If these two configurations are configured, the default password generated will not be displayed at startup. = username = password

How to disable default username and password for spring boot security?

There are two ways to disable the spring boot security from showing the login page. The first method is using The pre-defined property allows to exclude the SecurityAutoConfiguration class from the auto configure. The example below shows the configuration in file

The second method is excluding the SecurityAutoConfiguration class in the spring boot application main class. The example below shows how to exclude SecurityAutoConfiguration class in the main class.

package com.yawintutor;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
public class SpringBootSecuritySimpleApplication {
	public static void main(String[] args) {, args);

How to customize the default username and password for spring boot security?

The default behavior of username and password can be customized by extending WebSecurityConfigurerAdapter class. The step by step procedure to configure spring boot security is explained in another post.

package com.yawintutor;

import org.springframework.context.annotation.Configuration;

public class SpringBootSecurityConfiguration extends WebSecurityConfigurerAdapter {

	public void configure(AuthenticationManagerBuilder auth) throws Exception {

please follow the below step by step configuration

Leave a Reply