私は次のものを持っています:
public class DifferentClass {
Map<String,AnotherClass>someMap;
}
public class AnotherClass {
Class<?> dataType;
public void setDataType(Class<?> val) {
this.dataType=val;
}
}
public class A {
...
public static class B {
...
}
...
}
次のSpring Bean構成:
<bean id="springRefName" class="my.project.path.to.DifferentClass">
...
<property name="someMap">
<map>
...
<entry key="someName">
<bean class= "my.project.path.to.AnotherClass">
<property name="dataType" value="my.project.path.to.A$B" />
</bean>
</entry>
...
</map >
</プロパティ>
...
</bean>
私が抱えている問題は、dataType.getCanonicalName() を呼び出すと、my.project.path.to.A しか取得できないことです。そのため、クラスに変換して AnotherClass.dataType に割り当てるときに、Spring が名前を切り捨てていると私は信じています。$ と a の両方で試しました。