• 大小: 2.15MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-26
  • 语言: 其他
  • 标签: Shiro  

资源简介

Spring springboot,Mybatis、Shiro 实现动态授权, 避免了在使用Shiro时 在系统控制层 加入权限判断进行鉴权处理!

资源截图

代码片段和文件信息

package com.zlkj.shiro.dyprem;
import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;

import com.zlkj.shiro.dyprem.execption.DefaultExceptionHandler;
/**
 * @2017年8月6日
 * @Description:系统入口配置
 */
@SpringBootApplication
@PropertySource(value={ “classpath:config.properties“ })
@EnableTransactionManagement(proxyTargetClass=true)
public class ApplicationConfiguration extends SpringBootServletInitializer {
@Autowired
private Environment env;
@Autowired
private DataSource druidDataSource;
@Bean
public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {
ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet);
registration.getUrlMappings().clear();
registration.addUrlMappings(“/*“);
return registration;
}
/**
 * 外置Tomcat 启动入口
 */
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(ApplicationConfiguration.class);
}

@Bean
    public PlatformTransactionManager transactionManager() {
        return new DataSourceTransactionManager(druidDataSource);
    }

@Bean
public org.springframework.jdbc.core.JdbcTemplate  jdbcTemplate(DataSource druidDataSource){
return new JdbcTemplate(druidDataSource);
}

@Bean
public DefaultExceptionHandler DefaultExceptionHandler(){
return new DefaultExceptionHandler();
}

@Bean
public ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver(){
return new ExceptionHandlerExceptionResolver();
}



public static void main(String[] args) {
new SpringApplication(ApplicationConfiguration.class).run(args);
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-08-12 21:11  Shiro-maven\
     文件        1308  2017-08-10 16:37  Shiro-maven\.classpath
     目录           0  2017-08-12 21:16  Shiro-maven\.git\
     目录           0  2017-08-12 21:11  Shiro-maven\.git\branches\
     文件          79  2017-08-12 21:11  Shiro-maven\.git\config
     文件          23  2017-08-12 21:11  Shiro-maven\.git\HEAD
     目录           0  2017-08-12 21:11  Shiro-maven\.git\hooks\
     文件       88248  2017-08-12 21:16  Shiro-maven\.git\index
     目录           0  2017-08-12 21:16  Shiro-maven\.git\logs\
     文件         216  2017-08-12 21:16  Shiro-maven\.git\logs\HEAD
     目录           0  2017-08-12 21:11  Shiro-maven\.git\logs\refs\
     目录           0  2017-08-12 21:16  Shiro-maven\.git\logs\refs\heads\
     文件         216  2017-08-12 21:16  Shiro-maven\.git\logs\refs\heads\master
     目录           0  2017-08-12 21:16  Shiro-maven\.git\objects\
     目录           0  2017-08-12 21:16  Shiro-maven\.git\objects\00\
     文件       33838  2017-08-12 21:15  Shiro-maven\.git\objects\00\3375ff46b1eb2e9e4bfff5fd76f12630a628b7
     文件         682  2017-08-12 21:15  Shiro-maven\.git\objects\00\dc7f94fd7977a8f40e967df8e15e8bcfc546f8
     文件         713  2017-08-12 21:16  Shiro-maven\.git\objects\00\e48f394702c363ce77a3e7c0a8af9f995bb740
     目录           0  2017-08-12 21:16  Shiro-maven\.git\objects\01\
     文件        1522  2017-08-12 21:16  Shiro-maven\.git\objects\01\c5d5c905863838365639beddfb23b1f596d2cf
     文件         488  2017-08-12 21:16  Shiro-maven\.git\objects\01\ead8502c906c4bbbcf245ebc060f875e2bdc4f
     目录           0  2017-08-12 21:16  Shiro-maven\.git\objects\02\
     文件         336  2017-08-12 21:16  Shiro-maven\.git\objects\02\08c559679188a41a05d51951add622ec77019c
     文件         361  2017-08-12 21:16  Shiro-maven\.git\objects\02\36b5f84a0bff437a275346d9c5add9050bc13f
     文件         434  2017-08-12 21:16  Shiro-maven\.git\objects\02\ab5ebbe88850f0391b67ade6dcff0ea8626bb9
     目录           0  2017-08-12 21:16  Shiro-maven\.git\objects\04\
     文件         319  2017-08-12 21:16  Shiro-maven\.git\objects\04\525a2835638c244aef397890f2d5d30e059ce4
     文件         861  2017-08-12 21:16  Shiro-maven\.git\objects\04\9d6ba4bfaa2b1a72b7a905dfb1a3422ef0a199
     文件        2803  2017-08-12 21:16  Shiro-maven\.git\objects\04\a5b7c440aa9bc069cd2bbd9e16b4a74bdd9aed
     文件         755  2017-08-12 21:16  Shiro-maven\.git\objects\04\d183f913228f9d186c141a7e98e32349c917cc
     目录           0  2017-08-12 21:16  Shiro-maven\.git\objects\05\
............此处省略1687个文件信息

评论

共有 条评论