【今日学んだこと】未経験からエンジニアで転職「4週間目その3」
今日からリモート開始
今日やったこと
Spring Boot 2実践入門:簡単なWEBアプリを一から作成チュートリアル | MicroStone
- エラーの解決しようとする(途中)
できなかったこと
明日やること
- エラーの解決しようとする(途中)
- 同世代祭りシステムのを進める
今週やること
来週やること
めも
Javaのこと
spring boot mysql mybatis mavenな記事を探して簡単でもいいから作ってみる
探したいけどあんまりないな、、? とりあえずなんでもいいからその環境に合わせてしようかな、、、
Spring Bootを使って簡単なMVCのサンプルシステムを作ってみました - Qiita
H2だけどもっかいこれに倣ってやってみる
Spring Boot 2実践入門:簡単なWEBアプリを一から作成チュートリアル | MicroStone
STS4 をダウンロードし直す
3だったから動かなかったとかあるんかな、、
Spring Tool Suite 4インストールマニュアル - Qiita
【Java】Lombokで冗長コードを削減しよう | キャスレーコンサルティング株式会社
依存ライブラリを選択にValidation
がない →あとでpom.xml修正すればいいか
やっぱりエラー出るのか、、、 1つずつ潰そう。
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.UnsatisfiedDependencyException: Error creating bean with name 'itemMapper' defined in file [/Users/hikari/Documents/workspace-spring-tool-suite-4-4.5.1.RELEASE/demo/target/classes/com/example/demo/mapper/ItemMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.UncategorizedScriptException: Failed to execute database script from resource [URL [file:/Users/hikari/Documents/workspace-spring-tool-suite-4-4.5.1.RELEASE/demo/target/classes/schema.sql]]; nested exception is java.lang.IllegalArgumentException: 'script' must not be null or empty
Beanがうんぬんっていっぱい出てきてる
Spring BootにおけるBeanクラスとは - 親バカエンジニアのナレッジ帳
ふあああああ 繋がった、、、
schema.sqlかけてなかっただけだった、、、
Spring Boot 2実践入門:簡単なWEBアプリを一から作成チュートリアル | MicroStone
のでもがひらけたーようやく
これのdemoを元に、コード読み解きながら同世代祭りシステムの形にして行こう
と思ったけど、よく見たら変更と削除、更新が動いてなさそう
これも出てた
とりあえず、めもって項目足してみた、大丈夫そう
demoのをH2データベースってのからMySQLにする
Spring Boot 2実践入門:簡単なWEBアプリを一から作成チュートリアル | MicroStone
より、
H2データベースを利用しています。H2はJavaで実装されたリレーションデータベースであり、データはメモリに保存されます。WEBサーバーが起動するたびにデータがクリアされます
らしいので、MySQLにしたい
というかとりあえずここでgitに挙げとこうかな
STSで作成したプロジェクトをGitHubにアップロード(連携,push)する方法 | 株式会社CONFRAGE ITソリューション事業部
できた
そういやマイグレーションってないのかな Flyway
Spring Bootでflywayを使ってみた。 - Qiita
文字列が含まれるファイルを検索する方法 - [Eclipse/開発環境 ツール類] ぺんたん info
おーつなげれたしマイグレーションも動いてるーーーーーーーーー 嬉しみ
とりあえずDB作っちゃおう
外部キー設定の仕方いまいちよくわからんので一旦置いとく
なんかエラー
sql - バージョンFlywayへの移行の失敗が検出されました - 初心者向けチュートリアル
書いてあるコマンドうったら真っ赤なエラー
flywayのmavenコマンドメモとドキュメントへのリンク | Monotalk
実行したらマイグレーション走っちゃってすでにテーブルあるよーって怒られる 1回だけとかないのかな、と思ったけどそのあとこれでなくなったな
マイグレーションはあったけどシーダーはないのかな、ぱっと見なさそう
色々修正してたらこれでた
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.demo.mapper.JobMapper.findAll
This application has no explicit mapping for /error, so you are seeing this as a fallback.
com.example.demo.mapper.JobMapper.findAll
の何がおかしいんやーこの辺買えてない、、、
https://git-manual.net/eclipse-git-new-branch-remote-push/
↑によるとなんかファイルの場所変えたらいけたってあるから、 .mapperから.serviceに変えたら、後ろのがfindAll→findOneに変わった、、、
この辺りっぽいのかな、、、ってところで今日は終わり。
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.demo.mapper.JobMapper.findOne
??ってなったところ
いまいちよくわからない
[java.io] Java文字列入力のまとめ (InputStream, Reader, Scanner) - Qiita
エラーのところ
戻ってやりたいこと
外部キー設定
セキュリティ的なの何も気にしてないCSRFあたりってどうするんだろ