项目介绍

本系统采用springboot脚手架,数据层采用mybatis,数据库使用mysql,

适合选题:课程培训、在线教育、网站等类目

项目技术

后端:springboot mybatis
前端:jsp、js、css bootstrap jquery等
开发工具:idea/eclipse
数据库:mysql 5.7
JDK版本:jdk1.8

功能概述

本系统有以下等功能

课程管理:对课程进行管理支持增加删除修改、可以发布视频或者图片

教师管理:对教学老师进行管理。

导航菜单:设置系统导航菜单,便于切换

订单管理:对订单进行管理

通知管理等功能

项目展示

基于springboot mybaits的在线课程系统_毕设

基于springboot mybaits的在线课程系统_数据库_02

编辑

基于springboot mybaits的在线课程系统_数据库_03

基于springboot mybaits的在线课程系统_mysql_04

编辑

基于springboot mybaits的在线课程系统_毕设_05

基于springboot mybaits的在线课程系统_毕设_06

编辑

核心代码



/**
* shiro过滤器
*/
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) {

ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
shiroFilter.setSecurityManager(securityManager);
// 登录配置
shiroFilter.setLoginUrl("/login");
shiroFilter.setSuccessUrl("/");
shiroFilter.setUnauthorizedUrl("/error?code=403");
// 自定义过滤器
Map<String, Filter> filtersMap = new LinkedHashMap<>();
filtersMap.put("slf", new ShiroLoginFilter());
shiroFilter.setFilters(filtersMap);
// 拦截配置
Map<String, String> filterChainDefinitions = new LinkedHashMap<>();
filterChainDefinitions.put("/assets/**", "anon");
filterChainDefinitions.put("/favicon.ico", "anon");
filterChainDefinitions.put("/api/**", "anon");
filterChainDefinitions.put("/error", "anon");
filterChainDefinitions.put("/login", "anon");
filterChainDefinitions.put("/default/**", "anon");
filterChainDefinitions.put("/users/**", "anon");
filterChainDefinitions.put("/getFileURL/**", "anon");
filterChainDefinitions.put("/logout", "logout");
//filterChainDefinitions.put("/**", "slf,authc");
filterChainDefinitions.put("/**", "slf,user"); // 记住密码也能访问
shiroFilter.setFilterChainDefinitionMap(filterChainDefinitions);
return shiroFilter;
}

/**
* adminRealm
*/
@Bean(name = "adminRealm")
@DependsOn("lifecycleBeanPostProcessor")
public AdminRealm adminRealm() {
AdminRealm adminRealm = new AdminRealm();
// 密码凭证器
adminRealm.setCredentialsMatcher(new HashedCredentialsMatcher("md5"));
return adminRealm;
}

/**
* userRealm
*/
@Bean(name = "userRealm")
@DependsOn("lifecycleBeanPostProcessor")
public UserRealm userRealm() {
UserRealm userRealm = new UserRealm();
// 密码凭证器
userRealm.setCredentialsMatcher(new HashedCredentialsMatcher("md5"));
return userRealm;
}

/**
* 安全管理器
*/
@Bean(name = "securityManager")
public DefaultWebSecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
//设置realm.
securityManager.setAuthenticator(modularRealmAuthenticator());
List<Realm> realms = new ArrayList<>();
realms.add(userRealm());
realms.add(adminRealm());
securityManager.setRealms(realms);
securityManager.setCacheManager(cacheManager());
securityManager.setRememberMeManager(cookieRememberMeManager());
return securityManager;
}

/**
* 系统自带的Realm管理,主要针对多realm
* */
@Bean
public ModularRealmAuthenticator modularRealmAuthenticator(){
//自己重写的ModularRealmAuthenticator
CustomizedModularRealmAuthenticator modularRealmAuthenticator = new CustomizedModularRealmAuthenticator();
modularRealmAuthenticator.setAuthenticationStrategy(new AtLeastOneSuccessfulStrategy());
return modularRealmAuthenticator;
}

/**
* 缓存管理器
*/
@Bean(name = "cacheManager")
public EhCacheManager cacheManager() {
EhCacheManager cacheManager = new EhCacheManager();
net.sf.ehcache.CacheManager cm = net.sf.ehcache.CacheManager.getCacheManager("shirocache");
if (cm == null) {
String configFile = "classpath:ehcache/ehcache-shiro.xml";
InputStream is = null;
try {
is = ResourceUtils.getInputStreamForPath(configFile);
cm = new net.sf.ehcache.CacheManager(is);
} catch (IOException e) {
throw new IllegalStateException("Unable to obtain input stream for cacheManagerConfigFile [" + configFile + "]", e);
} finally {
ResourceUtils.close(is);
}
}
cacheManager.setCacheManager(cm);
return cacheManager;
}

/**
* 记住密码cookie
*/
@Bean
public SimpleCookie rememberMeCookie() {
SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
simpleCookie.setMaxAge(60 * 60 * 24 * 7); // 过期时间7天
return simpleCookie;
}

/**
* 记住密码cookie管理器
*/
@Bean
public CookieRememberMeManager cookieRememberMeManager() {
CookieRememberMeManager manager = new CookieRememberMeManager();
manager.setCookie(rememberMeCookie());
manager.setCipherKey(Base64.decode("BT7lf0hw4W/QMxpS/Rb+Ng=="));
return manager;
}

/**
* 开启shiro注解功能
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() {
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
advisor.setSecurityManager(securityManager());
return advisor;
}

@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}

基于springboot mybaits的在线课程系统_mysql_07