質問編集履歴
7
githubのrepositoryを削除した旨を記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
[githubにあげたソースコード](https://github.com/yukikoike/sample/tree/faeture_add_authentication)
|
32
32
|
|
33
|
-
|
33
|
+
↑repositoryを削除致しました。
|
34
34
|
|
35
35
|
|
36
36
|
|
6
パッケージ名を変更しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
Field userRepository in co.jp.
|
7
|
+
Field userRepository in co.jp.yuki.koike.sample.domain.service.user.UserDetailsServiceImpl required a bean of type 'co.jp.yuki.koike.sample.domain.service.user.UserRepository' that could not be found.
|
8
8
|
|
9
9
|
」
|
10
10
|
|
@@ -12,11 +12,11 @@
|
|
12
12
|
|
13
13
|
恐らく、
|
14
14
|
|
15
|
-
sample\src\main\java\co\jp\
|
15
|
+
sample\src\main\java\co\jp\yuki\koike\sample\domain\service\user\UserDetailsServiceImpl.java
|
16
16
|
|
17
17
|
か、
|
18
18
|
|
19
|
-
sample\src\main\java\co\jp\
|
19
|
+
sample\src\main\java\co\jp\yuki\koike\sample\domain\service\user\UserRepository.java
|
20
20
|
|
21
21
|
に原因があると思います。
|
22
22
|
|
@@ -56,9 +56,9 @@
|
|
56
56
|
|
57
57
|
|
58
58
|
|
59
|
-
2018-06-20 09:00:37.955 INFO 8960 --- [ main] co.jp.
|
60
|
-
|
61
|
-
2018-06-20 09:00:37.970 INFO 8960 --- [ main] co.jp.
|
59
|
+
2018-06-20 09:00:37.955 INFO 8960 --- [ main] co.jp.yuki.koike.sample.SampleApplication : Starting SampleApplication on DESKTOP-BD2CRPU with PID 8960 (C:\Users\nec\git\sample\target\classes started by nec in C:\Users\nec\git\sample)
|
60
|
+
|
61
|
+
2018-06-20 09:00:37.970 INFO 8960 --- [ main] co.jp.yuki.koikr.sample.SampleApplication : No active profile set, falling back to default profiles: default
|
62
62
|
|
63
63
|
2018-06-20 09:00:38.601 INFO 8960 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@61230f6a: startup date [Wed Jun 20 09:00:38 JST 2018]; root of context hierarchy
|
64
64
|
|
@@ -112,7 +112,7 @@
|
|
112
112
|
|
113
113
|
|
114
114
|
|
115
|
-
Field userRepository in co.jp.
|
115
|
+
Field userRepository in co.jp.yuki.koikr.sample.domain.service.user.UserDetailsServiceImpl required a bean of type 'co.jp.yuki.koikr.sample.domain.service.user.UserRepository' that could not be found.
|
116
116
|
|
117
117
|
|
118
118
|
|
@@ -122,7 +122,7 @@
|
|
122
122
|
|
123
123
|
|
124
124
|
|
125
|
-
Consider defining a bean of type 'co.jp.
|
125
|
+
Consider defining a bean of type 'co.jp.yuki.koike.sample.domain.service.user.UserRepository' in your configuration.
|
126
126
|
|
127
127
|
```
|
128
128
|
|
@@ -132,7 +132,7 @@
|
|
132
132
|
|
133
133
|
```java
|
134
134
|
|
135
|
-
package co.jp.
|
135
|
+
package co.jp.yuki.koike.sample.domain.service.user;
|
136
136
|
|
137
137
|
|
138
138
|
|
@@ -152,7 +152,7 @@
|
|
152
152
|
|
153
153
|
|
154
154
|
|
155
|
-
import co.jp.
|
155
|
+
import co.jp.yuki.koike.sample.domain.model.User;
|
156
156
|
|
157
157
|
|
158
158
|
|
@@ -196,7 +196,7 @@
|
|
196
196
|
|
197
197
|
```java
|
198
198
|
|
199
|
-
package co.jp.
|
199
|
+
package co.jp.yuki.koike.sample.domain.service.user;
|
200
200
|
|
201
201
|
|
202
202
|
|
@@ -204,7 +204,7 @@
|
|
204
204
|
|
205
205
|
|
206
206
|
|
207
|
-
import co.jp.
|
207
|
+
import co.jp.yuki.koike.sample.domain.model.User;
|
208
208
|
|
209
209
|
|
210
210
|
|
5
ソースコードを記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -125,3 +125,97 @@
|
|
125
125
|
Consider defining a bean of type 'co.jp.g.n.sample.domain.service.user.UserRepository' in your configuration.
|
126
126
|
|
127
127
|
```
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
■ UserDetailsServiceImpl.java
|
132
|
+
|
133
|
+
```java
|
134
|
+
|
135
|
+
package co.jp.g.n.sample.domain.service.user;
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
import java.util.Optional;
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
import org.springframework.beans.factory.annotation.Autowired;
|
144
|
+
|
145
|
+
import org.springframework.security.core.userdetails.UserDetails;
|
146
|
+
|
147
|
+
import org.springframework.security.core.userdetails.UserDetailsService;
|
148
|
+
|
149
|
+
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
150
|
+
|
151
|
+
import org.springframework.stereotype.Service;
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
import co.jp.g.n.sample.domain.model.User;
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
@Service
|
160
|
+
|
161
|
+
public class UserDetailsServiceImpl implements UserDetailsService {
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
@Autowired
|
166
|
+
|
167
|
+
UserRepository userRepository;
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
@Override
|
174
|
+
|
175
|
+
public UserDetails loadUserByUsername(String username)
|
176
|
+
|
177
|
+
throws UsernameNotFoundException {
|
178
|
+
|
179
|
+
User user = Optional.ofNullable(userRepository.findOne(username))
|
180
|
+
|
181
|
+
.orElseThrow(() -> new UsernameNotFoundException(username + " is not found."));
|
182
|
+
|
183
|
+
return new UserDetailsImpl(user);
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
```
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
■ UserRepository.java
|
196
|
+
|
197
|
+
```java
|
198
|
+
|
199
|
+
package co.jp.g.n.sample.domain.service.user;
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
import org.springframework.data.jpa.repository.JpaRepository;
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
import co.jp.g.n.sample.domain.model.User;
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
public interface UserRepository extends JpaRepository<User, String> {
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
User findOne(String username);
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
```
|
4
リンクを修正致しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,9 +28,7 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
■ githubにあげたソースコード
|
32
|
-
|
33
|
-
[https://github.com/yukikoike/sample/tree/faeture_add_authentication
|
31
|
+
[githubにあげたソースコード](https://github.com/yukikoike/sample/tree/faeture_add_authentication)
|
34
32
|
|
35
33
|
|
36
34
|
|
3
リンクを記載致しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
■ githubにあげたソースコード
|
32
32
|
|
33
|
-
https://github.com/yukikoike/sample/tree/faeture_add_authentication
|
33
|
+
[https://github.com/yukikoike/sample/tree/faeture_add_authentication]
|
34
34
|
|
35
35
|
|
36
36
|
|
2
<code>でログを囲いました
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
■ 起動時のログ
|
40
40
|
|
41
|
-
|
41
|
+
```
|
42
42
|
|
43
43
|
|
44
44
|
|
@@ -126,8 +126,4 @@
|
|
126
126
|
|
127
127
|
Consider defining a bean of type 'co.jp.g.n.sample.domain.service.user.UserRepository' in your configuration.
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
```
|
1
誤記がありました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -131,9 +131,3 @@
|
|
131
131
|
|
132
132
|
|
133
133
|
---------------------------------------
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
■ githubにあげたソースコード
|
138
|
-
|
139
|
-
https://github.com/yukikoike/sample/tree/faeture_add_authentication
|