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 2022/12/18 01:07:00 UTC

[jira] [Commented] (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=17648955#comment-17648955 ] 

Dániel Dékány commented on FREEMARKER-177:
------------------------------------------

How do I recreate this issue? I have tried many things. Java 8 and Spring Boot Starter 2.6.0, 2.7.0, and 2.7.6. Also with Java 11 and 2.7.6. Also Java 17 and Spring Boot Starter 3.0.0 and Java 17. I have defined a {{freemarker.template.Configuration}} bean in a {{@Configuration}} class, that simply creates it with the constructor, and then I get that bean with {{ApplicationContext.getBean}}. Then I did the same with XML configuration and 2.7.x, and I have even set the {{settings}} property to a {{Properties}} object in the XML. All the combinations worked.

As a side note, Java's {{BeanIntrospector}} has no problem with that property. It just says that the {{setting}} property has type {{Map}} (the common ancestor class of {{Map}} and {{Properties}}), and both a read method, and a write method. But, that's not the point. I need to make Spring to fail in order to find the most backward compatible workaround.

> 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.20.10#820010)