SpringMVC Mybatis Shiro RestTemplate的實現客戶端無狀態驗證及訪問控制【轉】

2019獨角獸企業重金招聘Python工程師標準>>> hot3.png

A.首先需要搭建SpringMVC+Shiro環境

a1.pom.xml配置
?spring:

<dependency>

?<groupId>org.springframework</groupId>

<artifactId>spring-webmvc</artifactId><version>4.1.0.RELEASE</version>
</dependency>
<dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId><version>4.1.0.RELEASE</version>
</dependency>
<dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>4.1.0.RELEASE</version>
</dependency>
<dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>4.1.0.RELEASE</version>
</dependency>
<dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>1.8.7</version>
</dependency>

?Mybatis:

<dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.3.0</version>
</dependency>
<dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>1.2.3</version>
</dependency>
<dependency><groupId>jdbc.driver</groupId><artifactId>oracle.n</artifactId><version>12.1.0.1.RELEASE</version>
</dependency>
<dependency><groupId>c3p0</groupId><artifactId>c3p0</artifactId><version>0.9.1.2</version>
</dependency>

JSON轉換,Bean轉換,加密,文件上傳,日志記錄等相關工具:

<dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>2.6.3</version>
</dependency>
<dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.6.3</version>
</dependency>
<dependency><groupId>net.sf.json-lib</groupId><artifactId>json-lib</artifactId><version>2.2.2-jdk15</version>
</dependency>
<dependency><groupId>net.sf.ezmorph</groupId><artifactId>ezmorph</artifactId><version>1.0.6</version>
</dependency>
<dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.9</version>
</dependency>
<dependency><groupId>commons-beanutils</groupId><artifactId>commons-beanutils</artifactId><version>1.7.0</version>
</dependency>
<dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2</version>
</dependency>
<dependency><groupId>commons-lang</groupId><artifactId>commons-lang</artifactId><version>2.4</version>
</dependency>
<dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.3.1</version>
</dependency>
<dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.7.7</version>
</dependency>

shiro:

<dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-core</artifactId><version>1.2.2</version>
</dependency>
<dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-web</artifactId><version>1.2.2</version>
</dependency>
<dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-spring</artifactId><version>1.2.2</version>
</dependency>

a2.web.xml配置

?

<!-- 定義應用在Spring容器中的全局標志,避免沖突 -->
<context-param><param-name>webAppRootKey</param-name><param-value>reedws</param-value>
</context-param>
<!-- 配置SpringMVC入口 -->
<servlet><servlet-name>mvc</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/spring-mvc.xml</param-value></init-param><load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping><servlet-name>mvc</servlet-name><url-pattern>/</url-pattern>
</servlet-mapping><!-- 加載log4j配置文件 -->
<context-param><param-name>log4jConfigLocation</param-name><param-value>classpath:log4j.properties</param-value>
</context-param>
<listener><listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener><!-- 配置Spring業務層,shiro相關配置就處于業務層 -->
<context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/spring-mybatis.xml,classpath:spring/spring-service.xml,classpath:spring/spring-shiro.xml</param-value>
</context-param>
<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener><!-- 配置Spring自帶的Web應用生命周期管理器 -->
<listener><listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener><!-- 配置全局編碼,和項目編碼一致即可,此處用GBK,建議用UTF-8 -->
<filter><filter-name>encoding</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>GBK</param-value></init-param>
</filter>
<filter-mapping><filter-name>encoding</filter-name><url-pattern>/*</url-pattern>
</filter-mapping><!-- 和shiro整合,通過過濾器代理配置shiro的過濾器 -->
<filter><filter-name>shiroFilter</filter-name><filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class><init-param><param-name>targetFilterLifecycle</param-name><param-value>true</param-value></init-param>
</filter>
<filter-mapping><filter-name>shiroFilter</filter-name><url-pattern>/*</url-pattern>
</filter-m
?

核心技術:Maven,Springmvc mybatis shiro, Druid, Restful,?

Dubbo, ZooKeeper,Redis,FastDFS,ActiveMQ,Nginx?
1.?????項目核心代碼結構截圖

分布式框架介紹 - kafkaee - kafkaee的博客

?? 項目模塊依賴

分布式框架介紹 - kafkaee - kafkaee的博客

?

特別提醒:開發人員在開發的時候可以將自己的業務REST服務化或者Dubbo服務化

2.????項目依賴介紹

???2.1?后臺管理系統、Rest服務系統、Scheculer定時調度系統依賴如下圖:

?

分布式框架介紹 - kafkaee - kafkaee的博客

?????? 2.2?Dubbo獨立服務項目依賴如下圖:

?分布式框架介紹 - kafkaee - kafkaee的博客

3.??項目功能部分截圖:

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客
?

zookeeper、dubbo服務啟動?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客
?

dubbo管控臺?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?REST服務平臺

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

?

分布式框架介紹 - kafkaee - kafkaee的博客

轉載于:https://my.oschina.net/bngkjdnhfkjg/blog/755709

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542443.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542443.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542443.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

sql服務器默認密碼_搭建一個DNS服務器,輕松實現域名解析內容分發,訪問速度提高N倍...

DNS服務器&#xff0c;Domain Name Server&#xff0c;域名解析服務器&#xff0c;互聯網上相互通信使用的是IP&#xff0c;但是IP是又長又臭又難記&#xff0c;所以創造了域名來解決IP難寫難記的問題&#xff0c;記一個g.cn比203.208.50.127強過不知多少倍了。有了域名&#x…

在C ++ STL中使用string :: to_string()將數字轉換為字符串

to_string() is a library function of <string> header, it is used to convert numeric value (number) to string. to_string()是<string>標頭的庫函數&#xff0c;用于將數值(數字)轉換為字符串。 Syntax: 句法&#xff1a; string to_string(numberic_value…

門級建模

學習目標 學習Verilog提供的門級原語 理解門的實例引用、門的符號以及and/or&#xff0c;buf/not類型的門的真值表 學習如何根據電路的羅技圖來生成Verilog描述 講述門級設計中的上升、下降和關斷延遲 解釋門級設計中的最小、最大和典型延遲 1.門的類型 1.1與門&#xff08;and…

linux .net 控制臺應用程序,VisualStudioCode創建的asp.net core控制臺程序部署到linux

1、asp.net core控制臺程序static void Main(string[] args){int times10;while(times>0){Console.WriteLine("Hello World!");times--;Thread.Sleep(1000);}}2、發布發布前&#xff0c;修改test2.csproj文件(項目名稱為test2)Exenetcoreapp2.1centos.7-x64主要添…

數組長度屬性以及JavaScript中的示例

JavaScript長度屬性 (JavaScript length property) length property is used to get and set the length of an array in JavaScript. length屬性用于獲取和設置JavaScript中數組的長度。 Syntax to get the length of an array: 獲取數組長度的語法&#xff1a; array_name.…

怎么挖linux內核的漏洞,linux內核漏洞分析實戰看看專家是怎么一步步...-卓優商學院問答...

推薦回答Linux內核調試方法kdb&#xff1a;只能在匯編代碼級進行調試&#xff1b;優點是不需要兩臺機器進行調試。gdb&#xff1a;在調試模塊時缺少一些至關重要的功能&#xff0c;它可用來查看內核的運行情況&#xff0c;包括反匯編內核函數。kgdb&#xff1a;能很方便的在源碼…

COGS182 [USACO Jan07] 均衡隊形[RMQ]

182. [USACO Jan07] 均衡隊形 ★★ 輸入文件&#xff1a;lineup.in 輸出文件&#xff1a;lineup.out 簡單對比時間限制&#xff1a;4 s 內存限制&#xff1a;128 MB 題目描述 農夫約翰的 N (1 ≤ N ≤ 50,000) 頭奶牛&#xff0c;每天擠奶時總會按同樣的順序站好。一日…

string中concat_JavaScript中帶示例的String concat()方法

string中concat字符串concat()方法 (String concat() Method) concat() is a string method in JavaScript, it is used to concatenate (join) two or more strings and returns a new joined string. concat()是JavaScript中的字符串方法&#xff0c;用于連接(聯接)兩個或多個…

linux全自動備份網站到百度云盤,Linux定時備份數據到百度云盤(示例代碼)

導讀&#xff1a;如今的百度云盤免費容量都是2T了&#xff0c;即使把電腦上所有的東東都放上去&#xff0c;也還有大把的剩余空間。對于站長來說&#xff0c;是完全可以充分利用這些硬盤空間的&#xff0c;現在我們就用百度云盤來備份Linux服務器上的數據。一直在想&#xff0c…

python dict底層實現_dict實現原理和哈希表

dict底層實現在Python中&#xff0c;字典是依靠散列表或說哈希表(Hash Table)進行實現的&#xff0c;使用開放地址法解決沖突。所以其查找的時間復雜度會是O(1)&#xff0c;下文會具體講解哈希表的工作原理和解決沖突時的具體方法。也就是說&#xff0c;字典也是一個數組&#…

網際控制報文協議icmp_網絡中的ICMP(Internet控制消息協議)

網際控制報文協議icmpICMP(Internet控制消息協議)簡介 (Introduction to ICMP (Internet Control Message Protocol)) IP (Internet Protocol) is a network layer protocol. The responsibility of delivering data (Logical Addressing) to any network is done by the IP (I…

談色

最近很苦惱&#xff0c;像是到了男人的生理期&#xff0c;或者說是類似動物的發情期&#xff0c;見到露長腿的女人總喜歡看。 其實我是并不喜歡這樣盯著看&#xff0c;或許是男人的本色&#xff0c;十個男人九個色的本性&#xff0c;總是會不自覺的去偷看&#xff0c;更有甚者還…

linux系統怎樣寫單片機程序,單片機知識是Linux驅動開發的基礎之一以及如何學單片機...

這是arm裸機1期加強版第1課第2、3節課程的wiki文字版。為什么沒前途也要學習單片機&#xff1f;因為它是個很好的入口。學習單片機可以讓我們拋開復雜的軟件結構&#xff0c;先掌握硬件操作&#xff0c;如&#xff1a;看原理圖、芯片手冊、寫程序操作寄存器等。在上一節視頻里&…

python教程循環語句_Python教程:關于Python 循環語句

Python 循環語句本章節將向大家介紹Python的循環語句&#xff0c;程序在一般情況下是按順序執行的。編程語言提供了各種控制結構&#xff0c;允許更復雜的執行路徑。循環語句允許我們執行一個語句或語句組多次&#xff0c;下面是在大多數編程語言中的循環語句的一般形式&#x…

math.pow int_Java Math類static int min(int i1,int i2)與示例

math.pow int數學類靜態int min(int i1&#xff0c;int i2) (Math Class static int min(int i1 , int i2) ) This method is available in java.lang package. 此方法在java.lang包中可用。 This method is used to return the minimum one of both the given arguments or in…

bat 批處理 常用命令和亂碼問題

為什么80%的碼農都做不了架構師&#xff1f;>>> rem echo off ECHO OFF XCOPY E:\test.bat D:\ IF ERRORLEVEL 1 ECHO 文件拷貝Failure IF ERRORLEVEL 0 ECHO 文件拷貝Success :start set /p first"1記事本,2遠程:" if %first% LEQ 2 (IF %first% …

SuperMap iServer發布的ArcGIS REST 地圖服務如何通過ArcGIS API加載

作者&#xff1a;yx 文章目錄 一、發布服務二、代碼加載三、結果展示 一、發布服務 SuperMap iServer支持將地圖發布為ArcGIS REST地圖服務&#xff0c;您可以在發布服務時直接勾選ArcGIS REST地圖服務&#xff0c;如下圖所示&#xff1a; 也可以在已發布的地圖服務中&#x…

c語言中的運算符及其含義_按位運算符及其在C語言中與Example一起使用

c語言中的運算符及其含義1)&#xff06;(按位與) (1) & (bitwise AND)) It does AND on every bit of two numbers. The result of AND is 1 only if both bits are 1. 它對兩個數字的每一位進行“與”運算。 僅當兩個位均為1時&#xff0c;AND的結果才為1。 Example: 例&…

能上網的Linux系統,那一款linux能上網

zhoushao12 于 2009-02-24 19:13:07發表:linux日常使用中,最重要的就是網絡(本人覺得)特別時ubuntu .但是現在電信偏偏搞什么賬號加密要用互聯星空軟件才可以撥號,更可惡的是這X軟件只有Windws版的!! 使得在linux下撥號上網變得十分麻煩!在網上找了很久終于找到解決方法!!下面拿…