{"id":922,"date":"2016-11-02T16:09:34","date_gmt":"2016-11-02T08:09:34","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=922"},"modified":"2016-11-02T16:09:49","modified_gmt":"2016-11-02T08:09:49","slug":"spring-boot%e6%95%b4%e5%90%88velocity%e7%9a%84%e9%85%8d%e7%bd%ae%e5%a4%a7%e5%85%a8","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=922","title":{"rendered":"spring-boot\u6574\u5408velocity\u7684\u914d\u7f6e\u5927\u5168"},"content":{"rendered":"<p>\n\t\u4e0a\u4e00\u7bc7\u6587\u7ae0\u4e2d\u63d0\u5230\u4e86Spring-boot \u63d0\u4f9b\u4e86\u5f88\u591a\u6a21\u677f\u5f15\u64ce\uff0c\u5176\u4e2d\u5c31\u5305\u62ec&nbsp;velocity \u3002\u672c\u6587\u5c06\u4ecb\u7ecd&nbsp;velocity \u548c&nbsp;spring-boot \u7684\u6574\u5408\u4f7f\u7528\u3002\n<\/p>\n<h2>\n\tpom \u4e2d\u5f15\u5165 spring-boot-starter-velocity \u914d\u7f6e<br \/>\n<\/h2>\n<pre class=\"brush:xml;\">\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-boot-starter-velocity&lt;\/artifactId&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<p>\n\t\u63a5\u4e0b\u6765\u5728src\/main\/resources \u76ee\u5f55\u4e2d\u65b0\u5efaapplication.properties\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u4e2d\u53ef\u4ee5\u8be6\u7ec6\u7684\u914d\u7f6e velocity \u7684\u76f8\u5173\u5c5e\u6027\u3002\n<\/p>\n<pre class=\"brush:plain;\">\r\n# VELOCITY TEMPLATES (VelocityAutoConfiguration)\r\n# Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name.\r\nspring.velocity.allow-request-override=false\r\n# Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name.\r\nspring.velocity.allow-session-override=false\r\n# Enable template caching.\r\nspring.velocity.cache=true\r\n# Template encoding.\r\nspring.velocity.charset=UTF-8\r\n# Check that the templates location exists.\r\nspring.velocity.check-template-location=true\r\n# Content-Type value.\r\nspring.velocity.content-type=text\/html\r\n# Name of the DateTool helper object to expose in the Velocity context of the view.\r\nspring.velocity.date-tool-attribute=\r\n# Enable MVC view resolution for this technology.\r\nspring.velocity.enabled=true\r\n# Set whether all request attributes should be added to the model prior to merging with the template.\r\nspring.velocity.expose-request-attributes=false\r\n# Set whether all HttpSession attributes should be added to the model prior to merging with the template.\r\nspring.velocity.expose-session-attributes=false\r\n# Set whether to expose a RequestContext for use by Spring&#039;s macro library, under the name &quot;springMacroRequestContext&quot;.\r\nspring.velocity.expose-spring-macro-helpers=true\r\n# Name of the NumberTool helper object to expose in the Velocity context of the view.\r\nspring.velocity.number-tool-attribute=\r\n# Prefer file system access for template loading. File system access enables hot detection of template changes.\r\nspring.velocity.prefer-file-system-access=true\r\n# Prefix that gets prepended to view names when building a URL.\r\nspring.velocity.prefix=\r\n# Additional velocity properties.\r\nspring.velocity.properties.*=\r\n# Name of the RequestContext attribute for all views.\r\nspring.velocity.request-context-attribute=\r\n# Template path.\r\nspring.velocity.resource-loader-path=classpath:\/templates\/\r\n# Suffix that gets appended to view names when building a URL.\r\nspring.velocity.suffix=.vm\r\n# Velocity Toolbox config location. For instance `\/WEB-INF\/toolbox.xml`\r\nspring.velocity.toolbox-config-location=\r\n# White list of view names that can be resolved.\r\nspring.velocity.view-names=<\/pre>\n<p>\n\t\u6700\u7ec8\u6574\u4e2a\u9879\u76ee\u7684\u76ee\u5f55\u662f\u8fd9\u6837\u7684\u3002\n<\/p>\n<pre class=\"brush:plain;\">\r\nsrc\r\n\u251c\u2500main\r\n\u2502  \u251c\u2500java\r\n\u2502  \u2502  \u2514\u2500com\r\n\u2502  \u2502      \u2514\u2500xttblog\r\n\u2502  \u2502          \u2502  Application.java\r\n\u2502  \u2502          \u2502\r\n\u2502  \u2502          \u2514\u2500controller\r\n\u2502  \u2502                  HomeController.java\r\n\u2502  \u2502\r\n\u2502  \u2514\u2500resources\r\n\u2502      \u2502  application.properties\r\n\u2502      \u2502\r\n\u2502      \u2514\u2500templates\r\n\u2502              index.vm\r\n\u2502\r\n\u2514\u2500test\r\n    \u251c\u2500java\r\n    \u2514\u2500resources\r\n<\/pre>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=922\">spring-boot\u6574\u5408velocity\u7684\u914d\u7f6e\u5927\u5168<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u4e00\u7bc7\u6587\u7ae0\u4e2d\u63d0\u5230\u4e86Spring-boot \u63d0\u4f9b\u4e86\u5f88\u591a\u6a21\u677f\u5f15\u64ce\uff0c\u5176\u4e2d\u5c31\u5305\u62ec&nbsp;velocity \u3002\u672c\u6587\u5c06 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[587,597,598,581],"class_list":["post-922","post","type-post","status-publish","format-standard","hentry","category-java","tag-spring-boot","tag-spring-boot-starter-velocity","tag-velocity","tag-581"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=922"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions"}],"predecessor-version":[{"id":923,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions\/923"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}