JavaでSpringを使って開発しています。
Beanの定義に関する質問なのですが、
nullを引数付きコンストラクタに紐付けるにはどうすればよいのでしょうか?
アプリ起動時に以下の例外が発生するのですが、どう修正すればいいかわかりません。
----例外メッセージ
`
[java] Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'someBean' defined in class path resource [spring-config.xml]:
Unsatisfied dependency expressed through constructor argument with index 0
of type [com.app.MyApp]: Could not convert constructor argument value of
type [java.lang.String] to required type [com.app.MyApp]: Failed to
convert value of type 'java.lang.String' to required type
'com.app.MyApp'; nested exception is java.lang.IllegalStateException:
Cannot convert value of type [java.lang.String] to required
type [com.app.MyApp]: no matching editors or conversion strategy found
I just want to create a Widget like I would if I wrote the following Java:
----Bean定義の内容
<bean id="someBean" class="com.app.MyApp">
<constructor-arg name="foo" value="null"/>
<constructor-arg name="hoge" ref="myBean" />
</bean>
`
ご回答宜しくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。