資源簡(jiǎn)介
Spring springboot,Mybatis、Shiro 實(shí)現(xiàn)動(dòng)態(tài)授權(quán), 避免了在使用Shiro時(shí) 在系統(tǒng)控制層 加入權(quán)限判斷進(jìn)行鑒權(quán)處理!

代碼片段和文件信息
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:系統(tǒng)入口配置
?*/
@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?啟動(dòng)入口
?*/
@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);
}
}
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????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\ob
?????目錄???????????0??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件???????33838??2017-08-12?21:15??Shiro-maven\.git\ob
?????文件?????????682??2017-08-12?21:15??Shiro-maven\.git\ob
?????文件?????????713??2017-08-12?21:16??Shiro-maven\.git\ob
?????目錄???????????0??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件????????1522??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件?????????488??2017-08-12?21:16??Shiro-maven\.git\ob
?????目錄???????????0??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件?????????336??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件?????????361??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件?????????434??2017-08-12?21:16??Shiro-maven\.git\ob
?????目錄???????????0??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件?????????319??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件?????????861??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件????????2803??2017-08-12?21:16??Shiro-maven\.git\ob
?????文件?????????755??2017-08-12?21:16??Shiro-maven\.git\ob
?????目錄???????????0??2017-08-12?21:16??Shiro-maven\.git\ob
............此處省略1687個(gè)文件信息
評(píng)論
共有 條評(píng)論