Commit 57c9435e by fengshuonan

调整自动配置

parent 32884964
package cn.stylefeng.guns.config;
import cn.stylefeng.guns.core.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.log.aop.LogAop;
import cn.stylefeng.guns.core.shiro.aop.PermissionAop;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Scope;
import org.springframework.core.annotation.Order;
import org.springframework.web.context.WebApplicationContext;
/**
* 系统默认的配置
*
* @author fengshuonan
* @Date 2019/5/10 22:51
*/
@Configuration
public class GunsConfig {
/**
* 快捷查询方法
*
* @author fengshuonan
* @Date 2019/5/10 22:52
*/
@Bean
@DependsOn("springContextHolder")
public ConstantFactory constantFactory() {
return new ConstantFactory();
}
/**
* Guns自带的日志切面
*
* @author fengshuonan
* @Date 2019/5/10 22:53
*/
@Bean
public LogAop logAop() {
return new LogAop();
}
/**
* Guns自带的日志切面
*
* @author fengshuonan
* @Date 2019/5/10 22:53
*/
@Bean
@Scope(scopeName = WebApplicationContext.SCOPE_SESSION)
public LogObjectHolder logObjectHolder() {
return new LogObjectHolder();
}
/**
* 权限校验aop
*
* @author fengshuonan
* @Date 2019/5/10 22:56
*/
@Bean
@Order(200)
public PermissionAop permissionAop() {
return new PermissionAop();
}
}
//package cn.stylefeng.guns.config;
//
//import cn.stylefeng.guns.core.schedue.quartz.StartQuartzExample;
//import cn.stylefeng.guns.core.schedue.spring.SpringTasks;
//import org.quartz.Scheduler;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
//
///**
// * 定时任务自动配置(需要定时任务的可以打开注释)
// *
// * @author fengshuonan
// * @Date 2019/2/24 16:23
// */
//@Configuration
//public class SchedulingConfig {
//
// /**
// * 定时任务执行测试,注意在Application上加@EnableScheduling
// *
// * @author fengshuonan
// * @Date 2019/3/27 2:48 PM
// */
// @Bean
// public SpringTasks scheduledTasks() {
// return new SpringTasks();
// }
//
// /**
// * quartz方式,配置Scheduler实例
// *
// * @author fengshuonan
// * @Date 2019/2/24 19:03
// */
// @Bean
// public Scheduler scheduler(SchedulerFactoryBean schedulerFactoryBean) {
// return schedulerFactoryBean.getScheduler();
// }
//
// /**
// * 启动quartz的示例
// *
// * @author fengshuonan
// * @Date 2019/3/27 3:34 PM
// */
// @Bean
// public StartQuartzExample startQuartzExample() {
// return new StartQuartzExample();
// }
//
//}
...@@ -18,8 +18,6 @@ package cn.stylefeng.guns.config.properties; ...@@ -18,8 +18,6 @@ package cn.stylefeng.guns.config.properties;
import cn.stylefeng.roses.core.util.ToolUtil; import cn.stylefeng.roses.core.util.ToolUtil;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.Properties; import java.util.Properties;
...@@ -29,8 +27,6 @@ import java.util.Properties; ...@@ -29,8 +27,6 @@ import java.util.Properties;
* @author fengshuonan * @author fengshuonan
* @date 2017-05-24 20:37 * @date 2017-05-24 20:37
*/ */
@Configuration
@ConfigurationProperties(prefix = BeetlProperties.BEETLCONF_PREFIX)
@Data @Data
public class BeetlProperties { public class BeetlProperties {
......
...@@ -17,8 +17,6 @@ package cn.stylefeng.guns.config.properties; ...@@ -17,8 +17,6 @@ package cn.stylefeng.guns.config.properties;
import cn.stylefeng.roses.core.util.ToolUtil; import cn.stylefeng.roses.core.util.ToolUtil;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.io.File; import java.io.File;
...@@ -30,8 +28,6 @@ import static cn.stylefeng.roses.core.util.ToolUtil.getTempPath; ...@@ -30,8 +28,6 @@ import static cn.stylefeng.roses.core.util.ToolUtil.getTempPath;
* @author stylefeng * @author stylefeng
* @Date 2017/5/23 22:31 * @Date 2017/5/23 22:31
*/ */
@Component
@ConfigurationProperties(prefix = GunsProperties.PREFIX)
@Data @Data
public class GunsProperties { public class GunsProperties {
......
package cn.stylefeng.guns.config.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 项目中的配置
*
* @author fengshuonan
* @Date 2019/5/10 22:45
*/
@Configuration
public class GunsPropertiesConfig {
@Bean
@ConfigurationProperties(prefix = BeetlProperties.BEETLCONF_PREFIX)
public BeetlProperties beetlProperties() {
return new BeetlProperties();
}
@Bean
@ConfigurationProperties(prefix = GunsProperties.PREFIX)
public GunsProperties gunsProperties() {
return new GunsProperties();
}
}
...@@ -28,8 +28,6 @@ import cn.stylefeng.roses.core.util.SpringContextHolder; ...@@ -28,8 +28,6 @@ import cn.stylefeng.roses.core.util.SpringContextHolder;
import cn.stylefeng.roses.core.util.ToolUtil; import cn.stylefeng.roses.core.util.ToolUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -40,8 +38,6 @@ import java.util.List; ...@@ -40,8 +38,6 @@ import java.util.List;
* @author fengshuonan * @author fengshuonan
* @date 2017年2月13日 下午10:55:21 * @date 2017年2月13日 下午10:55:21
*/ */
@Component
@DependsOn("springContextHolder")
public class ConstantFactory implements IConstantFactory { public class ConstantFactory implements IConstantFactory {
private RoleMapper roleMapper = SpringContextHolder.getBean(RoleMapper.class); private RoleMapper roleMapper = SpringContextHolder.getBean(RoleMapper.class);
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
package cn.stylefeng.guns.core.log; package cn.stylefeng.guns.core.log;
import cn.stylefeng.roses.core.util.SpringContextHolder; import cn.stylefeng.roses.core.util.SpringContextHolder;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
import java.io.Serializable; import java.io.Serializable;
...@@ -28,8 +25,6 @@ import java.io.Serializable; ...@@ -28,8 +25,6 @@ import java.io.Serializable;
* @author fengshuonan * @author fengshuonan
* @date 2017-03-31 11:19 * @date 2017-03-31 11:19
*/ */
@Component
@Scope(scopeName = WebApplicationContext.SCOPE_SESSION)
public class LogObjectHolder implements Serializable { public class LogObjectHolder implements Serializable {
private Object object = null; private Object object = null;
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
*/ */
package cn.stylefeng.guns.core.log.aop; package cn.stylefeng.guns.core.log.aop;
import cn.stylefeng.guns.core.log.annotion.BussinessLog;
import cn.stylefeng.guns.core.constant.dictmap.base.AbstractDictMap; import cn.stylefeng.guns.core.constant.dictmap.base.AbstractDictMap;
import cn.stylefeng.guns.core.log.LogManager; import cn.stylefeng.guns.core.log.LogManager;
import cn.stylefeng.guns.core.log.LogObjectHolder; import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.log.annotion.BussinessLog;
import cn.stylefeng.guns.core.log.factory.LogTaskFactory; import cn.stylefeng.guns.core.log.factory.LogTaskFactory;
import cn.stylefeng.guns.core.shiro.ShiroKit; import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser; import cn.stylefeng.guns.core.shiro.ShiroUser;
...@@ -32,7 +32,6 @@ import org.aspectj.lang.annotation.Pointcut; ...@@ -32,7 +32,6 @@ import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Map; import java.util.Map;
...@@ -44,7 +43,6 @@ import java.util.Map; ...@@ -44,7 +43,6 @@ import java.util.Map;
* @date 2016年12月6日 下午8:48:30 * @date 2016年12月6日 下午8:48:30
*/ */
@Aspect @Aspect
@Component
public class LogAop { public class LogAop {
private Logger log = LoggerFactory.getLogger(this.getClass()); private Logger log = LoggerFactory.getLogger(this.getClass());
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
package cn.stylefeng.guns.core.shiro; package cn.stylefeng.guns.core.shiro;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.AccessControlFilter; import org.apache.shiro.web.filter.AccessControlFilter;
import org.apache.shiro.web.util.WebUtils; import org.apache.shiro.web.util.WebUtils;
......
...@@ -23,8 +23,6 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -23,8 +23,6 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.naming.NoPermissionException; import javax.naming.NoPermissionException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -36,8 +34,6 @@ import java.lang.reflect.Method; ...@@ -36,8 +34,6 @@ import java.lang.reflect.Method;
* @date 2017-07-13 21:05 * @date 2017-07-13 21:05
*/ */
@Aspect @Aspect
@Component
@Order(200)
public class PermissionAop { public class PermissionAop {
@Autowired @Autowired
......
...@@ -21,6 +21,7 @@ import cn.stylefeng.guns.core.shiro.ShiroKit; ...@@ -21,6 +21,7 @@ import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser; import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.core.shiro.service.PermissionCheckService; import cn.stylefeng.guns.core.shiro.service.PermissionCheckService;
import cn.stylefeng.roses.core.util.HttpContext; import cn.stylefeng.roses.core.util.HttpContext;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -31,6 +32,7 @@ import java.util.ArrayList; ...@@ -31,6 +32,7 @@ import java.util.ArrayList;
* 权限自定义检查 * 权限自定义检查
*/ */
@Service @Service
@DependsOn("springContextHolder")
@Transactional(readOnly = true) @Transactional(readOnly = true)
public class PermissionCheckServiceServiceImpl implements PermissionCheckService { public class PermissionCheckServiceServiceImpl implements PermissionCheckService {
......
package cn.stylefeng.guns.config;
import cn.stylefeng.guns.core.schedue.quartz.StartQuartzExample;
import cn.stylefeng.guns.core.schedue.spring.SpringTasks;
import org.quartz.Scheduler;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
/**
* 定时任务自动配置(需要定时任务的可以打开注释)
*
* @author fengshuonan
* @Date 2019/2/24 16:23
*/
//@Configuration
public class SchedulingConfig {
/**
* 定时任务执行测试,注意在Application上加@EnableScheduling
*
* @author fengshuonan
* @Date 2019/3/27 2:48 PM
*/
@Bean
public SpringTasks scheduledTasks() {
return new SpringTasks();
}
/**
* quartz方式,配置Scheduler实例
*
* @author fengshuonan
* @Date 2019/2/24 19:03
*/
@Bean
public Scheduler scheduler(SchedulerFactoryBean schedulerFactoryBean) {
return schedulerFactoryBean.getScheduler();
}
/**
* 启动quartz的示例
*
* @author fengshuonan
* @Date 2019/3/27 3:34 PM
*/
@Bean
public StartQuartzExample startQuartzExample() {
return new StartQuartzExample();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment