これはstraight from the docsです:
設定クラスを作成します。
@Configuration
@EnableWebSecurity
public class HelloWebSecurityConfiguration
extends WebSecurityConfigurerAdapter {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
}
Newer Docs
これは多少異なりますが、効果は同じになります:
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public UserDetailsService userDetailsService() throws Exception {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(User.withUsername("user").password("password").roles("USER").build());
return manager;
}
}
この[投稿](https://stackoverflow.com/questions/37285016/what-is-username-and-password-when-starting-spring-boot-with-tomcat)が役立ち、解決策があるとしますあなたが期待しているもののために。 –
[TomcatでSpringブートを開始するときのユーザ名とパスワードは何ですか?](https://stackoverflow.com/questions/37285016/what-is-username-and-password-when-starting-spring-boot-with) -tomcat) – Graham