{"id":29637,"date":"2025-04-20T11:21:19","date_gmt":"2025-04-20T03:21:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/29637.html"},"modified":"2025-04-20T11:21:19","modified_gmt":"2025-04-20T03:21:19","slug":"springboot-%e6%95%b4%e5%90%88-springmvc%ef%bc%9a%e9%85%8d%e7%bd%ae%e5%b5%8c%e5%85%a5%e5%bc%8f%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/29637.html","title":{"rendered":"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668"},"content":{"rendered":"<li>\n<h5>\u4fee\u6539\u548c server \u76f8\u5173\u7684\u914d\u7f6e(ServerProperties)\uff1a<\/h5>\n<p> server.port=8081<br \/>\nserver.context\u2010path=\/tx<br \/>\nserver.tomcat.uri\u2010encoding=UTF\u20108 <\/li>\n<li>\u6ce8\u518c Servlet \u4e09\u5927\u7ec4\u4ef6\uff1aServlet\u3001Fileter\u3001Listener\n<li>SpringBoot \u9ed8\u8ba4\u662f\u4ee5 jar \u5305\u7684\u65b9\u5f0f\u542f\u52a8\u5d4c\u5165\u5f0f\u7684 Servlet \u5bb9\u5668\u6765\u542f\u52a8 SpringBoot \u7684 web\u5e94\u7528\uff0c\u6ca1\u6709\u5916\u90e8\u6587\u4ef6<\/li>\n<li>Servlet\uff1a \/\/\u6ce8\u518c\u4e09\u5927\u7ec4\u4ef6<br \/>\n@Bean<br \/>\npublic ServletRegistrationBean myServlet(){<br \/>\n    ServletRegistrationBean registrationBean = new ServletRegistrationBean(new<br \/>\n            MyServlet(),\\&#8221;\/myServlet\\&#8221;);<br \/>\n    return registrationBean;<br \/>\n} <\/li>\n<li>FilterRegisttratinBean\uff1a @Bean<br \/>\npublic FilterRegistrationBean myFilter(){<br \/>\n    FilterRegistrationBean registrationBean = new FilterRegistrationBean();<br \/>\n    registrationBean.setFilter(new MyFilter());<br \/>\n    registrationBean.setUrlPatterns(Arrays.asList(\\&#8221;\/hello\\&#8221;,\\&#8221;\/myServlet\\&#8221;));<br \/>\n    return registrationB<\/li>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u3010\u4ee3\u7801\u3011SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668\u3002_springmvc\u5982\u4f55\u6539\u9020\u6210\u5d4c\u5165\u5f0f\u7684tomcat<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[92,98,292],"topic":[],"class_list":["post-29637","post","type-post","status-publish","format-standard","hentry","category-server","tag-github","tag-spring-boot","tag-292"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/29637.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u3010\u4ee3\u7801\u3011SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668\u3002_springmvc\u5982\u4f55\u6539\u9020\u6210\u5d4c\u5165\u5f0f\u7684tomcat\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/29637.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-20T03:21:19+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/29637.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/29637.html\",\"name\":\"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-20T03:21:19+00:00\",\"dateModified\":\"2025-04-20T03:21:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/29637.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/29637.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/29637.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/29637.html","og_locale":"zh_CN","og_type":"article","og_title":"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e25\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u3010\u4ee3\u7801\u3011SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668\u3002_springmvc\u5982\u4f55\u6539\u9020\u6210\u5d4c\u5165\u5f0f\u7684tomcat","og_url":"https:\/\/www.wsisp.com\/helps\/29637.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-20T03:21:19+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/29637.html","url":"https:\/\/www.wsisp.com\/helps\/29637.html","name":"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-20T03:21:19+00:00","dateModified":"2025-04-20T03:21:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/29637.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/29637.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/29637.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"SpringBoot \u6574\u5408 SpringMVC\uff1a\u914d\u7f6e\u5d4c\u5165\u5f0f\u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/29637","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=29637"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/29637\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=29637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=29637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=29637"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=29637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}