cs4814751
V2EX  ›  Java

Spring boot 在使用 Thymeleaf 时 Intellij idea model 属性没法自动解析?

  •  
  •   cs4814751 · May 8, 2017 · 9699 views
    This topic created in 3495 days ago, the information mentioned may be changed or developed.

    问题如图

    是可以正常渲染的,但是 idea 没法解析,controller 里也无法和 view 关联上,Spring MVC 下没这个毛病啊,大家用的时候有这个问题吗?

    16 replies  •  2018-01-29 14:14:22 +08:00
    letitbesqzr
    letitbesqzr
    May 8, 2017❤️1
    1
    对 的确有这问题
    https://youtrack.jetbrains.com/issue/IDEA-132738

    看 comment 从 2015 年一直吐槽到了 2017 年了
    aitaii
    aitaii
    May 8, 2017 via Android
    2
    同样的问题,看着红线难受
    Grubber
    Grubber
    May 8, 2017 via Android
    3
    用 freemarker 的没问题
    qinxi
    qinxi
    May 9, 2017
    4
    <!--/*@thymesVar id="test" type="java.lang.Integer"*/-->

    同理

    <!--/*@thymesVar id="object" type="package.Object"*/-->
    qinxi
    qinxi
    May 9, 2017
    5
    @qinxi 其实就是按一下 alt+回车 的事
    cs4814751
    cs4814751
    OP
    May 9, 2017
    6
    @letitbesqzr 我也查到这个 issue 了,真蛋疼,这都多久了还不修
    cs4814751
    cs4814751
    OP
    May 9, 2017
    7
    @aitaii 是啊,看着别扭,不能自动解析
    cs4814751
    cs4814751
    OP
    May 9, 2017
    8
    @qinxi 这样是可以了,就是不太优雅 233 intellij 真懒,多久了还不修 bug
    letitbesqzr
    letitbesqzr
    May 9, 2017
    9
    @qinxi 但是那不得代码里全是这种咯?
    qinxi
    qinxi
    May 9, 2017
    10
    @cs4814751 插件问题吧.在 controller 的时候 就没有 超链接 到模板.所以在模板的时候就不知道哪个 controller 传过来的 model,当然就无法解析这个对象了
    qinxi
    qinxi
    May 9, 2017
    11
    @letitbesqzr 这种东西也有作用域..如果你的 model 的对象太多...那目前只能这样写..
    cs4814751
    cs4814751
    OP
    May 9, 2017
    12
    @qinxi 是啊 controller 和模板无法关联了 用 spring mvc 就没这问题 感觉对 spring boot 的支持还不够好
    hutaishi
    hutaishi
    Jul 30, 2017
    13
    cs4814751
    cs4814751
    OP
    Jul 30, 2017
    14
    @hutaishi https://youtrack.jetbrains.com/issue/IDEA-132738 spring boot 的 thymeleaf bug 仍未修复
    hutaishi
    hutaishi
    Jul 30, 2017
    15
    这个红色波浪线问题修复了吧。IDEA 现在对 thymeleaf 的识别还是可以的。
    hutaishi
    hutaishi
    Jan 29, 2018
    16
    2017.3 版本已经实现了功能。并且还添加了导航按钮。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2360 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 13:06 · PVG 21:06 · LAX 05:06 · JFK 08:06
    ♥ Do have faith in what you're doing.