質問編集履歴

1

誤字修正

2019/08/13 08:31

投稿

fsk5303
fsk5303

スコア21

test CHANGED
File without changes
test CHANGED
@@ -30,9 +30,9 @@
30
30
 
31
31
  ### Error querying database. Cause: org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSourceFactory]
32
32
 
33
- ### The error may exist in jp/co/example/testserver/mybatis/mapper/generated/TestMapper.xml
33
+ ### The error may exist in jp/co/example/testserver/mybatis/mapper/generated/TestTableMapper.xml
34
-
34
+
35
- ### The error may involve jp.co.example.testserver.mybatis.mapper.generated.TestMapper.selectByPrimaryKey
35
+ ### The error may involve jp.co.example.testserver.mybatis.mapper.generated.TestTableMapper.selectByPrimaryKey
36
36
 
37
37
  ### The error occurred while executing a query
38
38
 
@@ -312,6 +312,62 @@
312
312
 
313
313
  ```
314
314
 
315
+ - ApiController.java
316
+
317
+
318
+
319
+ ```java
320
+
321
+ @RestController
322
+
323
+ @RequestMapping("api")
324
+
325
+ public class ApiController {
326
+
327
+
328
+
329
+ @Autowired
330
+
331
+ private TestTableMapper testTableMapper;
332
+
333
+
334
+
335
+ /**
336
+
337
+ * 文字列を返す
338
+
339
+ *
340
+
341
+ * @return
342
+
343
+ * @throws IOException
344
+
345
+ */
346
+
347
+ @RequestMapping("hello")
348
+
349
+ private String hello(HttpServletRequest request, HttpServletResponse response) throws IOException {
350
+
351
+
352
+
353
+ TestTable testTable = testTableMapper.selectByPrimaryKey((long) 1);
354
+
355
+
356
+
357
+ LogUtils.info("api/helloエンドポイントにGetアクセスがありました。");
358
+
359
+
360
+
361
+ return "SpringBoot \"API & DB Access\" Test. 名前=" + testTable.getName();
362
+
363
+ }
364
+
365
+ }
366
+
367
+
368
+
369
+ ```
370
+
315
371
 
316
372
 
317
373
  - application.yml