@Bean
@Override
public UserDetailsService userDetailsService() {
UserDetails user =
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build();
return new InMemoryUserDetailsManager(user);
}
を下記に変更
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// パスワード
String password = passwordEncoder().encode("password");
// インメモリの認証を行うための設定
auth.inMemoryAuthentication()
.passwordEncoder(passwordEncoder())
.withUser("user").password(password).roles("USER");
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
photoUpload.setVersion(new Long((Integer) version));
>>
photoUpload.setVersion(Long.valueOf((Integer) version));
Map uploadResult = null;
>>
Map<?, ?> uploadResult = null;
new Transformation()
>>
new Transformation<>()
トップページを設定しようを追加
registry.addViewController("/").setViewName("forward:ideas");
# h2-consoleの使い方(SQL文の書き方)
* 一個一個実行して確かめてみよう。
# 2.1 一覧の表示
select * from idea;
select * from comment;
# 2.2. 紐付いたレコードの表示
select * from comment where idea_id = 1;
# 2.3. レコードの作成
insert into idea(name, description) values ('名前', '説明');
# 2.4. レコードの削除
delete from idea where id=3;
** 子レコードが紐付いたデータは削除出来ません。
# 2.5. レコードのアップデート
update idea set name='名前2', description='説明 xxx' where id=1;