Java之品優購課程講義_day04

nintyuui發表於2021-09-09

  1. SpringSecurity框架入門
    1.1 SpringSecurity簡介
    Spring Security 是一個能夠為基於 Spring 的企業應用系統提供宣告式的安全訪問控制解決方案的安全框架。它提供了一組可以在 Spring 應用上下文中配置的 Bean,充分利用了Spring IoC,DI(控制反轉 Inversion of Control ,DI:Dependency Injection 依賴注入)和 AOP(面向切面程式設計)功能,為應用系統提供宣告式的安全訪問控制功能,減少了為企業系統安全控制編寫大量重複程式碼的工作。
    1.2 SpringSecurity入門小 Demo
    1.2.1 最簡單 Demo
    (1)建立工程 spring-security-demo ,pom.xml 內容

<project  xmlns="" xmlns:xsi=""xsi:schemaLocation=" [url=][/url]"><modelVersion>4.0.0</modelVersion><groupId>cn.itcast.demo</groupId><artifactId>spring-security-demo</artifactId><packaging>war</packaging><version>0.0.1-SNAPSHOT</version><properties><spring.version>4.2.4.RELEASE</spring.version></properties><dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework.security</groupId><artifactId>spring-security-web</artifactId><version>4.1.0.RELEASE</version></dependency><dependency><groupId>org.springframework.security</groupId><artifactId>spring-security-config</artifactId><version>4.1.0.RELEASE</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version><scope>provided</scope></dependency></dependencies><build><plugins><!-- java 編譯外掛 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.2</version><configuration><source>1.7</source><target>1.7</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><configuration><!-- 指定埠 --><port>9090</port><!-- 請求路徑 --><path>/</path></configuration></plugin></plugins></build></project>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/3209/viewspace-2817091/,如需轉載,請註明出處,否則將追究法律責任。

相關文章