gpt4 book ai didi

spring - 如何在Groovy中使用

转载 作者:行者123 更新时间:2023-12-03 04:40:07 25 4
gpt4 key购买 nike

我想在<mvc:resource/>中使用<mvc:resources mapping="/images/**" location="/images/" />,例如<mvc:resources mapping="/resources/**" location="/resources/" /> context-mvc.groovy,但我不知道该怎么写。帮帮我〜

import org.springframework.web.servlet.view.InternalResourceViewResolver

beans {
xmlns context: "http://www.springframework.org/schema/context"


context."component-scan"("base-package" : "com.oberon.fm")

viewResolver(InternalResourceViewResolver) {
prefix = "/pages/"
suffix = ".jsp"
}
}

最佳答案

为了在Groovy中使用mvc命名空间,您需要将其添加到xmlns

然后,您可以像使用上下文一样使用它。

beans {

xmlns([ctx:'http://www.springframework.org/schema/context',
mvc:'http://www.springframework.org/schema/mvc'])

ctx.'component-scan'('base-package': "com.oberon.fm")
mvc.resources(mapping:"/images/**", location:"/images/")
mvc.resources(mapping:"/resources/**", location:"/resources/")
}

关于spring - 如何在Groovy中使用<mvc:resource/>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29382133/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com