質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Spring

Spring Framework は、Javaプラットフォーム向けのオープンソースアプリケーションフレームワークです。 Java Platform上に、 Web ベースのアプリケーションを設計するための拡張機能が数多く用意されています。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

Q&A

解決済

1回答

4782閲覧

Spring Boot でのMapper使い方(画面が表示されない)

janetto

総合スコア7

Spring

Spring Framework は、Javaプラットフォーム向けのオープンソースアプリケーションフレームワークです。 Java Platform上に、 Web ベースのアプリケーションを設計するための拡張機能が数多く用意されています。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

0グッド

0クリップ

投稿2020/11/01 07:40

編集2020/11/01 07:50

お世話になっております。

こちらのサイトを参考にWebアプリケーションを作っていた者です。

どこを間違えている可能性がありますか?

意見いただけると幸いです。
足りない情報があれば追加していきます。

過去の質問の回答を参考に書こうとしましたが、
上記の内容とどこを照らし合わせたらいいのかわかりません。

コンソール画面

OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
/ __)| |)| | | | | || (
| | ) ) ) )
' || .__|| ||| |_, | / / / /
=========|
|==============|
/=////
:: Spring Boot :: (v2.1.16.RELEASE)

2020-11-01 16:18:14.068 INFO 6220 --- [ restartedMain] com.example.demo.DemoApplication : Starting DemoApplication on matsumotosusumurounoMacBook-puro.local with PID 6220 (/Users/matsumotosusumurou/source/My Mac (matsumotosusumurounoMacBook-puro.local)/Documents/splingboot-workspace/demo/target/classes started by matsumotosusumurou in /Users/matsumotosusumurou/source/My Mac (matsumotosusumurounoMacBook-puro.local)/Documents/splingboot-workspace/demo)
2020-11-01 16:18:14.072 INFO 6220 --- [ restartedMain] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
2020-11-01 16:18:14.113 INFO 6220 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-11-01 16:18:14.113 INFO 6220 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-11-01 16:18:14.637 WARN 6220 --- [ restartedMain] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.example.demo]' package. Please check your configuration.
2020-11-01 16:18:14.986 INFO 6220 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-11-01 16:18:15.006 INFO 6220 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-11-01 16:18:15.007 INFO 6220 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-11-01 16:18:15.084 INFO 6220 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-11-01 16:18:15.084 INFO 6220 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 970 ms
2020-11-01 16:18:15.129 WARN 6220 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'itemController': Unsatisfied dependency expressed through field 'itemService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'itemService': Unsatisfied dependency expressed through field 'itemMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.exmple.demo.mapper.ItemMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2020-11-01 16:18:15.131 INFO 6220 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-11-01 16:18:15.147 INFO 6220 --- [ restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-01 16:18:15.272 ERROR 6220 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Field itemMapper in com.example.demo.service.ItemService required a bean of type 'com.exmple.demo.mapper.ItemMapper' that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'com.exmple.demo.mapper.ItemMapper' in your configuration.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

ItemMapperインターフェースに@Mapperのアノテーションを記載していますか?
記載していてエラーが発生している場合はさらに、@SpringBootApplicationのアノテーションを追加してみてください。

私も以前このエラーに引っかかりました(Mapperインターフェースではなかった..)が上記アノテーションを追加したら
エラーが解消されました!
@SpringBootApplicationを記載しているクラスは自動でbeanが生成される?
よく説明できないですがこれで解決できれば幸いです。

投稿2020/11/10 12:58

yusn1230

総合スコア31

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問