In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to configure Springboot picture virtual mapping, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Create a location where the static resource of MyWebAppConfigurer configuration needs to be mapped, it is recommended to write the path of addResourceLocations in application.yml, and load the external configuration file and modify the aspect when the package modification configuration file is deployed in the future. This is written in the code in order to save time.
Package io.renren.config;import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurer / * @ author lyy * 2021.11.21 * / / springboot 2.x configuration @ Configurationpublic class MyWebAppConfigurer implements WebMvcConfigurer {@ Override public void addResourceHandlers (ResourceHandlerRegistry registry) {registry.addResourceHandler ("/ image/**"). AddResourceLocations ("file:C:\ Users\ Administrator\ Desktop\ November setup\");}}
two。 Without permission control, you can access it directly through the IP+ port + project name and the path in addResourceHandler. If you have permission control, you need permission to rest assured or put it under the static static resource folder. Shiro permission for personal use, so it needs to be released.
@ Bean ("shiroFilter") public ShiroFilterFactoryBean shiroFilter (SecurityManager securityManager) {ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean (); shiroFilter.setSecurityManager (securityManager); / / oauth filter Map filters = new HashMap (); filters.put ("oauth3", new OAuth3Filter ()); shiroFilter.setFilters (filters); Map filterMap = new LinkedHashMap (); filterMap.put ("/ webjars/**", "anon") FilterMap.put ("/ druid/**", "anon"); filterMap.put ("/ app/**", "anon"); filterMap.put ("/ sys/login", "anon"); filterMap.put ("/ swagger/**", "anon"); filterMap.put ("/ v2/api-docs", "anon") FilterMap.put ("/ swagger-ui.html", "anon"); filterMap.put ("/ swagger-resources/**", "anon"); filterMap.put ("/ captcha.jpg", "anon"); filterMap.put ("/ image/**", "anon"); filterMap.put ("/ *", "oauth3"); shiroFilter.setFilterChainDefinitionMap (filterMap); return shiroFilter;}
3. Mapping successful, accessing http://localhost:8080/renren-fast/image/v2-4f45411c72eb128a6085fc8173286ffc_1440w.jpg
These are all the contents of the article "how to configure Picture Virtual Mapping in Springboot". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
This article is to share with you about how PHP+ajax implements paging. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look. Details are as follows: HTML code is as follows: title
Wechat
About us
Contact us
Product review
car news
thenatureplanet
More Form oMedia:
AutoTimes.
Bestcoffee.
SL News.
Jarebook.
Coffee Hunters.
Sundaily.
Modezone.
NNB.
Coffee.
Game News.
FrontStreet.
GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.