質問編集履歴

1

必要な文章の追加

2021/10/22 02:32

投稿

TanakaJirou
TanakaJirou

スコア18

test CHANGED
File without changes
test CHANGED
@@ -91,3 +91,31 @@
91
91
 
92
92
 
93
93
  org.springframework.boot 2.5.2
94
+
95
+
96
+
97
+
98
+
99
+ ### 調べてみて
100
+
101
+
102
+
103
+ 下記に解決方法みたいなのが書いてありますが
104
+
105
+ 下記方法以外ないのでしょうか
106
+
107
+ できれば@Autowiredで実現したいです
108
+
109
+
110
+
111
+ > AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfiguration.class);
112
+
113
+ > String helloCat = (String) context.getBean("hello", "Cat");
114
+
115
+ > String helloDog = (String) context.getBean("hello", "Dog");
116
+
117
+
118
+
119
+ コンストラクタに引数が必要なクラスのDIについて
120
+
121
+ https://teratail.com/questions/66194