You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Dániel Dékány (Jira)" <ji...@apache.org> on 2021/02/24 00:31:00 UTC

[jira] [Comment Edited] (FREEMARKER-177) freemarker Configurable has a asymmetric settings get/set which causes spring failure

    [ https://issues.apache.org/jira/browse/FREEMARKER-177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17289449#comment-17289449 ] 

Dániel Dékány edited comment on FREEMARKER-177 at 2/24/21, 12:30 AM:
---------------------------------------------------------------------

Unfortunately it doesn't matter much if for how long something is deprecated. Removing it is still not backward compatible. So, we going to have to figure out something else.

First of all, it would help to know what Spring is doing there and why. See, java.bean.Introspector doesn't fail, and it says that the type of the "settings" property is Map (the common ancestor class of Map and Properties), in all Java versions I tried (8, 9, 11, 13). But then Spring calls java.beans.PropertyDescriptor.setReadMethod(PropertyDescriptor.java:257), and that's when the problem happens. What leads Spring to do that?

For extra fun, setSettings has an additional overload, where the parameter is an InputStream.

It's also surprising that after 10+ years this suddenly comes up. Could it be that only certain version of Spring does this? Is that a new version?


was (Author: ddekany):
Unfortunately it doesn't matter much if for how long something is deprecated. Removing it is still not backward compatible. So, we going to have to figure out something else.

First of all, it would help to know what Spring is doing there and why. See, java.bean.Introspector doesn't fail, and its says that the type of the "settings" property is Map (the common ancestor class of Map and Properties), in all Java versions I tried (8, 9, 11, 13). But then Spring calls java.beans.PropertyDescriptor.setReadMethod(PropertyDescriptor.java:257), and that's when the problem happens. Why leads Spring to do that?

For extra fun, setSettings has an additional overload, where the parameter is an InputStream.

It's also surprising that after 10+ years this suddenly comes up. Could it be that only certain version of Spring does this? Is that a new version?

> freemarker Configurable has a asymmetric settings get/set which causes spring failure
> -------------------------------------------------------------------------------------
>
>                 Key: FREEMARKER-177
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-177
>             Project: Apache Freemarker
>          Issue Type: Bug
>    Affects Versions: 2.3.29
>            Reporter: Gray
>            Priority: Major
>         Attachments: trace.txt
>
>
> When I try to configure freemarker.template.Configuration in spring, it throws the exception: 
> {{Caused by: org.springframework.beans.FatalBeanException: Failed to obtain BeanInfo for class [freemarker.template.Configuration]; nested exception is java.beans.IntrospectionException: type mismatch between read and write methods}}
> The problem is that setSettings(...) takes a Properties and getSettings() returns a Map.  The get has been deprecated forever.   Can it please be fixed?  The alternative is having to do some spring hackery.
> See: [https://github.com/apache/freemarker/pull/74]
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)