3 changed files with 256 additions and 256 deletions
@ -1,68 +1,68 @@ |
|||
package com.ccsens.wechatutil.api; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.PropUtil; |
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.wx.WxXcxUtil; |
|||
import com.ccsens.wechatutil.bean.dto.WechatCode; |
|||
import com.ccsens.wechatutil.wxmini.MiniCodeUtil; |
|||
import com.ccsens.wechatutil.wxofficial.OfficialAccountMessageUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
@Api(tags = "DEBUG" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/debug") |
|||
@Slf4j |
|||
public class DebugController { |
|||
|
|||
|
|||
|
|||
@ApiOperation(value = "/测试",notes = "") |
|||
@ApiImplicitParams({ |
|||
}) |
|||
@RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse debug(HttpServletRequest request) throws Exception { |
|||
|
|||
return JsonResponse.newInstance().ok("测试"); |
|||
} |
|||
|
|||
@ApiOperation(value = "/测试",notes = "") |
|||
@ApiImplicitParams({ |
|||
}) |
|||
@RequestMapping(value="code",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse debugWxCode(HttpServletRequest request) throws Exception { |
|||
//生成二维码
|
|||
String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png"; |
|||
String path = WebConstant.UPLOAD_PATH_BASE + fileName; |
|||
|
|||
WechatCode.WechatCodeB wechatCodeB = new WechatCode.WechatCodeB(); |
|||
wechatCodeB.setPage(WebConstant.QRCODE_GAME); |
|||
wechatCodeB.setScene("id=1&type=SQ"); |
|||
MiniCodeUtil.getWxCodeB(wechatCodeB, path); |
|||
// WxXcxUtil.getWxCodeC(WebConstant.QRCODE_GAME+"?id=" + gameRecord.getId() + "&type=" + gameType.getCode(), path, gameType.getCode());
|
|||
|
|||
// gameRecord.setQrCodeUrl(PropUtil.qrCode + fileName);
|
|||
log.info("调用微信生成二维码"); |
|||
return JsonResponse.newInstance().ok("测试"); |
|||
} |
|||
|
|||
@ApiOperation(value = "/测试公众号消息",notes = "") |
|||
@ApiImplicitParams({ |
|||
}) |
|||
@RequestMapping(value="message",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse debugWxMessage(HttpServletRequest request) throws Exception { |
|||
// OfficialAccountMessageUtil.officialMessage();
|
|||
log.info("发送公众号消息"); |
|||
return JsonResponse.newInstance().ok("测试"); |
|||
} |
|||
|
|||
} |
|||
//package com.ccsens.wechatutil.api;
|
|||
//
|
|||
//import cn.hutool.core.date.DateUtil;
|
|||
//import com.ccsens.util.JsonResponse;
|
|||
//import com.ccsens.util.PropUtil;
|
|||
//import com.ccsens.util.WebConstant;
|
|||
//import com.ccsens.util.wx.WxXcxUtil;
|
|||
//import com.ccsens.wechatutil.bean.dto.WechatCode;
|
|||
//import com.ccsens.wechatutil.wxmini.MiniCodeUtil;
|
|||
//import com.ccsens.wechatutil.wxofficial.OfficialAccountMessageUtil;
|
|||
//import io.swagger.annotations.Api;
|
|||
//import io.swagger.annotations.ApiImplicitParams;
|
|||
//import io.swagger.annotations.ApiOperation;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|||
//import org.springframework.web.bind.annotation.RequestMethod;
|
|||
//import org.springframework.web.bind.annotation.RestController;
|
|||
//
|
|||
//import javax.servlet.http.HttpServletRequest;
|
|||
//
|
|||
//@Api(tags = "DEBUG" , description = "DebugController | ")
|
|||
//@RestController
|
|||
//@RequestMapping("/debug")
|
|||
//@Slf4j
|
|||
//public class DebugController {
|
|||
//
|
|||
//
|
|||
//
|
|||
// @ApiOperation(value = "/测试",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debug(HttpServletRequest request) throws Exception {
|
|||
//
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "/测试",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="code",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debugWxCode(HttpServletRequest request) throws Exception {
|
|||
// //生成二维码
|
|||
// String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
|
|||
// String path = WebConstant.UPLOAD_PATH_BASE + fileName;
|
|||
//
|
|||
// WechatCode.WechatCodeB wechatCodeB = new WechatCode.WechatCodeB();
|
|||
// wechatCodeB.setPage(WebConstant.QRCODE_GAME);
|
|||
// wechatCodeB.setScene("id=1&type=SQ");
|
|||
// MiniCodeUtil.getWxCodeB(wechatCodeB, path);
|
|||
//// WxXcxUtil.getWxCodeC(WebConstant.QRCODE_GAME+"?id=" + gameRecord.getId() + "&type=" + gameType.getCode(), path, gameType.getCode());
|
|||
//
|
|||
//// gameRecord.setQrCodeUrl(PropUtil.qrCode + fileName);
|
|||
// log.info("调用微信生成二维码");
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
// @ApiOperation(value = "/测试公众号消息",notes = "")
|
|||
// @ApiImplicitParams({
|
|||
// })
|
|||
// @RequestMapping(value="message",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|||
// public JsonResponse debugWxMessage(HttpServletRequest request) throws Exception {
|
|||
//// OfficialAccountMessageUtil.officialMessage();
|
|||
// log.info("发送公众号消息");
|
|||
// return JsonResponse.newInstance().ok("测试");
|
|||
// }
|
|||
//
|
|||
//}
|
|||
|
@ -1,31 +1,31 @@ |
|||
package com.ccsens.wechatutil.config; |
|||
|
|||
import com.ccsens.wechatutil.intercept.MybatisInterceptor; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: wuHuiJuan |
|||
* @create: 2019/12/03 18:01 |
|||
*/ |
|||
@Configuration |
|||
public class BeanConfig { |
|||
//package com.ccsens.wechatutil.config;
|
|||
//
|
|||
//import com.ccsens.wechatutil.intercept.MybatisInterceptor;
|
|||
//import org.springframework.context.annotation.Bean;
|
|||
//import org.springframework.context.annotation.Configuration;
|
|||
//
|
|||
///**
|
|||
// * @description:
|
|||
// * @author: wuHuiJuan
|
|||
// * @create: 2019/12/03 18:01
|
|||
// */
|
|||
//@Configuration
|
|||
//public class BeanConfig {
|
|||
//// @Bean
|
|||
//// public static PropertySourcesPlaceholderConfigurer properties(){
|
|||
//// PropertySourcesPlaceholderConfigurer conf = new PropertySourcesPlaceholderConfigurer();
|
|||
//// YamlPropertiesFactoryBean yml = new YamlPropertiesFactoryBean();
|
|||
//// yml.setResources(new ClassPathResource("business.yml"));
|
|||
//// conf.setProperties(yml.getObject());
|
|||
//// return conf;
|
|||
//// }
|
|||
//
|
|||
// /**
|
|||
// * 注册拦截器
|
|||
// */
|
|||
// @Bean
|
|||
// public static PropertySourcesPlaceholderConfigurer properties(){
|
|||
// PropertySourcesPlaceholderConfigurer conf = new PropertySourcesPlaceholderConfigurer();
|
|||
// YamlPropertiesFactoryBean yml = new YamlPropertiesFactoryBean();
|
|||
// yml.setResources(new ClassPathResource("business.yml"));
|
|||
// conf.setProperties(yml.getObject());
|
|||
// return conf;
|
|||
// public MybatisInterceptor mybatisInterceptor() {
|
|||
// MybatisInterceptor interceptor = new MybatisInterceptor();
|
|||
// return interceptor;
|
|||
// }
|
|||
|
|||
/** |
|||
* 注册拦截器 |
|||
*/ |
|||
@Bean |
|||
public MybatisInterceptor mybatisInterceptor() { |
|||
MybatisInterceptor interceptor = new MybatisInterceptor(); |
|||
return interceptor; |
|||
} |
|||
} |
|||
//}
|
|||
|
@ -1,171 +1,171 @@ |
|||
package com.ccsens.wechatutil.config; |
|||
|
|||
|
|||
import cn.hutool.core.lang.Snowflake; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import com.ccsens.util.config.DruidProps; |
|||
import com.fasterxml.jackson.databind.DeserializationFeature; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.fasterxml.jackson.databind.module.SimpleModule; |
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.http.converter.HttpMessageConverter; |
|||
import org.springframework.http.converter.StringHttpMessageConverter; |
|||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|||
import org.springframework.web.servlet.config.annotation.*; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.sql.DataSource; |
|||
import java.nio.charset.Charset; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
@Configuration |
|||
//public class SpringConfig extends WebMvcConfigurationSupport {
|
|||
public class SpringConfig implements WebMvcConfigurer { |
|||
@Resource |
|||
private DruidProps druidPropsUtil; |
|||
@Value("${spring.snowflake.workerId}") |
|||
private String workerId; |
|||
@Value("${spring.snowflake.datacenterId}") |
|||
private String datacenterId; |
|||
|
|||
/** |
|||
* 配置Converter |
|||
* @return |
|||
*/ |
|||
@Bean |
|||
public HttpMessageConverter<String> responseStringConverter() { |
|||
StringHttpMessageConverter converter = new StringHttpMessageConverter( |
|||
Charset.forName("UTF-8")); |
|||
return converter; |
|||
} |
|||
|
|||
@Bean |
|||
public HttpMessageConverter<Object> responseJsonConverter(){ |
|||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); |
|||
List<MediaType> mediaTypeList = new ArrayList<>(); |
|||
mediaTypeList.add(MediaType.TEXT_HTML); |
|||
mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8); |
|||
converter.setSupportedMediaTypes(mediaTypeList); |
|||
|
|||
//converter.setObjectMapper();
|
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
SimpleModule simpleModule = new SimpleModule(); |
|||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); |
|||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); |
|||
objectMapper.registerModule(simpleModule); |
|||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
|||
converter.setObjectMapper(objectMapper); |
|||
|
|||
return converter; |
|||
} |
|||
|
|||
@Override |
|||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
|||
//super.configureMessageConverters(converters);
|
|||
converters.add(responseStringConverter()); |
|||
converters.add(responseJsonConverter()); |
|||
} |
|||
|
|||
@Override |
|||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { |
|||
configurer.favorPathExtension(false); |
|||
} |
|||
|
|||
@Override |
|||
public void addCorsMappings(CorsRegistry registry) { |
|||
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") |
|||
// .allowedMethods("*") // 允许提交请求的方法,*表示全部允许
|
|||
.allowedOrigins("*") // #允许向该服务器提交请求的URI,*表示全部允许
|
|||
.allowCredentials(true) // 允许cookies跨域
|
|||
.allowedHeaders("*") // #允许访问的头信息,*表示全部
|
|||
.maxAge(18000L); // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了
|
|||
|
|||
} |
|||
|
|||
/** |
|||
* 配置视图解析器 SpringBoot建议使用Thymeleaf代替jsp,动态页面默认路径:resources/template,静态页面默认路径: resources/static |
|||
* @return |
|||
*/ |
|||
//package com.ccsens.wechatutil.config;
|
|||
//
|
|||
//
|
|||
//import cn.hutool.core.lang.Snowflake;
|
|||
//import cn.hutool.core.util.IdUtil;
|
|||
//import com.ccsens.util.config.DruidProps;
|
|||
//import com.fasterxml.jackson.databind.DeserializationFeature;
|
|||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
//import com.fasterxml.jackson.databind.module.SimpleModule;
|
|||
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|||
//import org.springframework.beans.factory.annotation.Value;
|
|||
//import org.springframework.context.annotation.Bean;
|
|||
//import org.springframework.context.annotation.Configuration;
|
|||
//import org.springframework.http.MediaType;
|
|||
//import org.springframework.http.converter.HttpMessageConverter;
|
|||
//import org.springframework.http.converter.StringHttpMessageConverter;
|
|||
//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|||
//import org.springframework.web.servlet.config.annotation.*;
|
|||
//
|
|||
//import javax.annotation.Resource;
|
|||
//import javax.sql.DataSource;
|
|||
//import java.nio.charset.Charset;
|
|||
//import java.util.ArrayList;
|
|||
//import java.util.List;
|
|||
//
|
|||
//@Configuration
|
|||
////public class SpringConfig extends WebMvcConfigurationSupport {
|
|||
//public class SpringConfig implements WebMvcConfigurer {
|
|||
// @Resource
|
|||
// private DruidProps druidPropsUtil;
|
|||
// @Value("${spring.snowflake.workerId}")
|
|||
// private String workerId;
|
|||
// @Value("${spring.snowflake.datacenterId}")
|
|||
// private String datacenterId;
|
|||
//
|
|||
// /**
|
|||
// * 配置Converter
|
|||
// * @return
|
|||
// */
|
|||
// @Bean
|
|||
// public ViewResolver getViewResolver() {
|
|||
// InternalResourceViewResolver resolver = new InternalResourceViewResolver();
|
|||
// resolver.setPrefix("/WEB-INF/views/");
|
|||
// resolver.setSuffix(".jsp");
|
|||
// return resolver;
|
|||
// public HttpMessageConverter<String> responseStringConverter() {
|
|||
// StringHttpMessageConverter converter = new StringHttpMessageConverter(
|
|||
// Charset.forName("UTF-8"));
|
|||
// return converter;
|
|||
// }
|
|||
//
|
|||
// @Bean
|
|||
// public HttpMessageConverter<Object> responseJsonConverter(){
|
|||
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
|||
// List<MediaType> mediaTypeList = new ArrayList<>();
|
|||
// mediaTypeList.add(MediaType.TEXT_HTML);
|
|||
// mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
|
|||
// converter.setSupportedMediaTypes(mediaTypeList);
|
|||
//
|
|||
// //converter.setObjectMapper();
|
|||
// ObjectMapper objectMapper = new ObjectMapper();
|
|||
// SimpleModule simpleModule = new SimpleModule();
|
|||
// simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
|||
// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
|||
// objectMapper.registerModule(simpleModule);
|
|||
// objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|||
// converter.setObjectMapper(objectMapper);
|
|||
//
|
|||
// return converter;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
|||
// //super.configureMessageConverters(converters);
|
|||
// converters.add(responseStringConverter());
|
|||
// converters.add(responseJsonConverter());
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
|||
// configurer.favorPathExtension(false);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public void configureDefaultServletHandling(
|
|||
// DefaultServletHandlerConfigurer configurer) {
|
|||
// configurer.enable();
|
|||
// public void addCorsMappings(CorsRegistry registry) {
|
|||
// registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
|||
//// .allowedMethods("*") // 允许提交请求的方法,*表示全部允许
|
|||
// .allowedOrigins("*") // #允许向该服务器提交请求的URI,*表示全部允许
|
|||
// .allowCredentials(true) // 允许cookies跨域
|
|||
// .allowedHeaders("*") // #允许访问的头信息,*表示全部
|
|||
// .maxAge(18000L); // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了
|
|||
//
|
|||
// }
|
|||
|
|||
|
|||
/** |
|||
* 配置静态资源 |
|||
*/ |
|||
@Override |
|||
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|||
registry.addResourceHandler("swagger-ui.html") |
|||
.addResourceLocations("classpath:/META-INF/resources/"); |
|||
registry.addResourceHandler("/webjars/**") |
|||
.addResourceLocations("classpath:/META-INF/resources/webjars/"); |
|||
|
|||
registry.addResourceHandler("/uploads/**") |
|||
.addResourceLocations("file:///home/cloud/wechatutil/uploads/"); |
|||
//super.addResourceHandlers(registry);
|
|||
} |
|||
//
|
|||
// /**
|
|||
// * 配置拦截器
|
|||
// * @param registry
|
|||
// * 配置视图解析器 SpringBoot建议使用Thymeleaf代替jsp,动态页面默认路径:resources/template,静态页面默认路径: resources/static
|
|||
// * @return
|
|||
// */
|
|||
//// @Bean
|
|||
//// public ViewResolver getViewResolver() {
|
|||
//// InternalResourceViewResolver resolver = new InternalResourceViewResolver();
|
|||
//// resolver.setPrefix("/WEB-INF/views/");
|
|||
//// resolver.setSuffix(".jsp");
|
|||
//// return resolver;
|
|||
//// }
|
|||
//// @Override
|
|||
//// public void configureDefaultServletHandling(
|
|||
//// DefaultServletHandlerConfigurer configurer) {
|
|||
//// configurer.enable();
|
|||
//// }
|
|||
//
|
|||
//
|
|||
// /**
|
|||
// * 配置静态资源
|
|||
// */
|
|||
// @Override
|
|||
// public void addInterceptors(InterceptorRegistry registry) {
|
|||
//// addPathPatterns 用于添加拦截规则
|
|||
//// excludePathPatterns 用于排除拦截
|
|||
// registry.addInterceptor(tokenInterceptor())
|
|||
//// .addPathPatterns("/projects/**")
|
|||
//// .addPathPatterns("/messages/**")
|
|||
// .addPathPatterns("/users/**")
|
|||
// .excludePathPatterns("/users/signin")
|
|||
// .excludePathPatterns("/users/smscode")
|
|||
// .excludePathPatterns("/users/signup")
|
|||
// .excludePathPatterns("/users/password")
|
|||
// .excludePathPatterns("/users/account")
|
|||
// .excludePathPatterns("/users/token")
|
|||
// .excludePathPatterns("/users/claims")
|
|||
// .excludePathPatterns("/users/code")
|
|||
// .excludePathPatterns("/users/userId");
|
|||
//// .addPathPatterns("/plugins/**")
|
|||
//// .addPathPatterns("/delivers/**")
|
|||
//// .addPathPatterns("/tasks/**")
|
|||
//// .addPathPatterns("/members/**")
|
|||
//// .addPathPatterns("/templates/**")
|
|||
//// .addPathPatterns("/hardware/**");
|
|||
//// super.addInterceptors(registry);
|
|||
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|||
// registry.addResourceHandler("swagger-ui.html")
|
|||
// .addResourceLocations("classpath:/META-INF/resources/");
|
|||
// registry.addResourceHandler("/webjars/**")
|
|||
// .addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|||
//
|
|||
// registry.addResourceHandler("/uploads/**")
|
|||
// .addResourceLocations("file:///home/cloud/wechatutil/uploads/");
|
|||
// //super.addResourceHandlers(registry);
|
|||
// }
|
|||
////
|
|||
//// /**
|
|||
//// * 配置拦截器
|
|||
//// * @param registry
|
|||
//// */
|
|||
//// @Override
|
|||
//// public void addInterceptors(InterceptorRegistry registry) {
|
|||
////// addPathPatterns 用于添加拦截规则
|
|||
////// excludePathPatterns 用于排除拦截
|
|||
//// registry.addInterceptor(tokenInterceptor())
|
|||
////// .addPathPatterns("/projects/**")
|
|||
////// .addPathPatterns("/messages/**")
|
|||
//// .addPathPatterns("/users/**")
|
|||
//// .excludePathPatterns("/users/signin")
|
|||
//// .excludePathPatterns("/users/smscode")
|
|||
//// .excludePathPatterns("/users/signup")
|
|||
//// .excludePathPatterns("/users/password")
|
|||
//// .excludePathPatterns("/users/account")
|
|||
//// .excludePathPatterns("/users/token")
|
|||
//// .excludePathPatterns("/users/claims")
|
|||
//// .excludePathPatterns("/users/code")
|
|||
//// .excludePathPatterns("/users/userId");
|
|||
////// .addPathPatterns("/plugins/**")
|
|||
////// .addPathPatterns("/delivers/**")
|
|||
////// .addPathPatterns("/tasks/**")
|
|||
////// .addPathPatterns("/members/**")
|
|||
////// .addPathPatterns("/templates/**")
|
|||
////// .addPathPatterns("/hardware/**");
|
|||
////// super.addInterceptors(registry);
|
|||
//// }
|
|||
////
|
|||
//// @Bean
|
|||
//// public TokenInterceptor tokenInterceptor(){
|
|||
//// return new TokenInterceptor();
|
|||
//// }
|
|||
//
|
|||
// /**
|
|||
// * 配置数据源(单数据源)
|
|||
// */
|
|||
// @Bean
|
|||
// public DataSource dataSource(){
|
|||
// return druidPropsUtil.createDruidDataSource();
|
|||
// }
|
|||
//
|
|||
// @Bean
|
|||
// public TokenInterceptor tokenInterceptor(){
|
|||
// return new TokenInterceptor();
|
|||
// public Snowflake snowflake(){
|
|||
//// return new Snowflake(Long.valueOf(workerId),Long.valueOf(datacenterId));
|
|||
// return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId));
|
|||
// }
|
|||
|
|||
/** |
|||
* 配置数据源(单数据源) |
|||
*/ |
|||
@Bean |
|||
public DataSource dataSource(){ |
|||
return druidPropsUtil.createDruidDataSource(); |
|||
} |
|||
|
|||
@Bean |
|||
public Snowflake snowflake(){ |
|||
// return new Snowflake(Long.valueOf(workerId),Long.valueOf(datacenterId));
|
|||
return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId)); |
|||
} |
|||
} |
|||
//}
|
Loading…
Reference in new issue