V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cs4814751
V2EX  ›  Java

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

  •  
  •   cs4814751 · 2017-05-08 20:28:44 +08:00 · 8868 次点击
    这是一个创建于 2546 天前的主题,其中的信息可能已经有所发展或是发生改变。

    问题如图

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

    16 条回复    2018-01-29 14:14:22 +08:00
    letitbesqzr
        1
    letitbesqzr  
       2017-05-08 22:05:44 +08:00   ❤️ 1
    对 的确有这问题
    https://youtrack.jetbrains.com/issue/IDEA-132738

    看 comment 从 2015 年一直吐槽到了 2017 年了
    aitaii
        2
    aitaii  
       2017-05-08 22:14:44 +08:00 via Android
    同样的问题,看着红线难受
    Grubber
        3
    Grubber  
       2017-05-08 22:16:24 +08:00 via Android
    用 freemarker 的没问题
    qinxi
        4
    qinxi  
       2017-05-09 09:16:13 +08:00
    <!--/*@thymesVar id="test" type="java.lang.Integer"*/-->

    同理

    <!--/*@thymesVar id="object" type="package.Object"*/-->
    qinxi
        5
    qinxi  
       2017-05-09 09:17:46 +08:00
    @qinxi 其实就是按一下 alt+回车 的事
    cs4814751
        6
    cs4814751  
    OP
       2017-05-09 09:19:19 +08:00
    @letitbesqzr 我也查到这个 issue 了,真蛋疼,这都多久了还不修
    cs4814751
        7
    cs4814751  
    OP
       2017-05-09 09:19:38 +08:00
    @aitaii 是啊,看着别扭,不能自动解析
    cs4814751
        8
    cs4814751  
    OP
       2017-05-09 09:20:07 +08:00
    @qinxi 这样是可以了,就是不太优雅 233 intellij 真懒,多久了还不修 bug
    letitbesqzr
        9
    letitbesqzr  
       2017-05-09 09:25:36 +08:00
    @qinxi 但是那不得代码里全是这种咯?
    qinxi
        10
    qinxi  
       2017-05-09 09:26:44 +08:00
    @cs4814751 插件问题吧.在 controller 的时候 就没有 超链接 到模板.所以在模板的时候就不知道哪个 controller 传过来的 model,当然就无法解析这个对象了
    qinxi
        11
    qinxi  
       2017-05-09 09:29:55 +08:00
    @letitbesqzr 这种东西也有作用域..如果你的 model 的对象太多...那目前只能这样写..
    cs4814751
        12
    cs4814751  
    OP
       2017-05-09 10:02:00 +08:00
    @qinxi 是啊 controller 和模板无法关联了 用 spring mvc 就没这问题 感觉对 spring boot 的支持还不够好
    hutaishi
        13
    hutaishi  
       2017-07-30 23:12:47 +08:00
    cs4814751
        14
    cs4814751  
    OP
       2017-07-30 23:19:49 +08:00
    @hutaishi https://youtrack.jetbrains.com/issue/IDEA-132738 spring boot 的 thymeleaf bug 仍未修复
    hutaishi
        15
    hutaishi  
       2017-07-30 23:23:58 +08:00
    这个红色波浪线问题修复了吧。IDEA 现在对 thymeleaf 的识别还是可以的。
    hutaishi
        16
    hutaishi  
       2018-01-29 14:14:22 +08:00
    2017.3 版本已经实现了功能。并且还添加了导航按钮。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1324 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:58 · PVG 07:58 · LAX 16:58 · JFK 19:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.