mirror of
https://github.com/qiurunze123/miaosha.git
synced 2023-11-19 22:41:03 +08:00
update config
This commit is contained in:
parent
24acc80920
commit
9455fd6e37
|
@ -30,13 +30,13 @@ public class AccessInterceptor extends HandlerInterceptorAdapter{
|
|||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
if(handler instanceof HandlerMethod) {
|
||||
MiaoshaUser user = getUser(request, response);
|
||||
UserContext.setUser(user);
|
||||
HandlerMethod hm = (HandlerMethod)handler;
|
||||
AccessLimit accessLimit = hm.getMethodAnnotation(AccessLimit.class);
|
||||
if(accessLimit == null) {
|
||||
return true;
|
||||
}
|
||||
MiaoshaUser user = getUser(request, response);
|
||||
UserContext.setUser(user);
|
||||
int seconds = accessLimit.seconds();
|
||||
int maxCount = accessLimit.maxCount();
|
||||
boolean needLogin = accessLimit.needLogin();
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.geekq.miaosha.config;
|
||||
|
||||
import com.geekq.miaosha.access.AccessInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -13,8 +15,18 @@ public class WebConfig extends WebMvcConfigurerAdapter {
|
|||
@Autowired
|
||||
UserArgumentResolver userArgumentResolver;
|
||||
|
||||
@Autowired
|
||||
private AccessInterceptor accessInterceptor;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
super.addInterceptors(registry);
|
||||
registry.addInterceptor(accessInterceptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(userArgumentResolver);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class RedisPoolFactory {
|
|||
poolConfig.setMaxTotal(redisConfig.getPoolMaxTotal());
|
||||
poolConfig.setMaxWaitMillis(redisConfig.getPoolMaxWait() * 1000);
|
||||
JedisPool jp = new JedisPool(poolConfig, redisConfig.getHost(), redisConfig.getPort(),
|
||||
redisConfig.getTimeout()*1000, redisConfig.getPassword(), 0);
|
||||
redisConfig.getTimeout()*1000, redisConfig.getPassword(), 8);
|
||||
return jp;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public class RedissonAutoConfiguration {
|
|||
RedissonClient redissonSingle() {
|
||||
Config config = new Config();
|
||||
SingleServerConfig serverConfig = config.useSingleServer()
|
||||
.setDatabase(9)
|
||||
.setAddress(redssionProperties.getAddress())
|
||||
.setTimeout(redssionProperties.getTimeout())
|
||||
.setConnectionPoolSize(redssionProperties.getConnectionPoolSize())
|
||||
|
|
|
@ -53,8 +53,8 @@ redis.poolMaxIdle=500
|
|||
redis.poolMaxWait=500
|
||||
|
||||
# redisson lock
|
||||
redisson.address=redis://localhost:6379
|
||||
redisson.password=123456
|
||||
redisson.address=redis://10.4.34.24:30009
|
||||
redisson.password=qazwsx.com
|
||||
#rabbitmq
|
||||
spring.rabbitmq.host=localhost
|
||||
spring.rabbitmq.port=5672
|
||||
|
|
|
@ -16,9 +16,9 @@ mybatis.mapperLocations=classpath:mybatis/mapper/*.xml
|
|||
#add mybatis
|
||||
mybatis.config-locations=classpath:mybatis/config.xml
|
||||
#datasource
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
||||
spring.datasource.url=jdbc:mysql://10.4.34.24:30006/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=aixiyue11
|
||||
spring.datasource.password=123qwe!@#
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
#druid
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
|
@ -44,20 +44,23 @@ spring.resources.chain.gzipped=true
|
|||
spring.resources.chain.html-application-cache=true
|
||||
spring.resources.static-locations=classpath:/static/
|
||||
#redis
|
||||
redis.host=192.168.1.116
|
||||
redis.port=6379
|
||||
redis.host=10.4.34.24
|
||||
redis.port=30009
|
||||
redis.timeout=100
|
||||
redis.password=123456
|
||||
redis.password=qazwsx.com
|
||||
redis.poolMaxTotal=1000
|
||||
redis.poolMaxIdle=500
|
||||
redis.poolMaxWait=500
|
||||
#server.port=8003
|
||||
|
||||
redisson.address=redis://10.4.34.24:30009
|
||||
redisson.password=qazwsx.com
|
||||
|
||||
#rabbitmq
|
||||
spring.rabbitmq.host=localhost
|
||||
spring.rabbitmq.port=5672
|
||||
spring.rabbitmq.username=guest
|
||||
spring.rabbitmq.password=guest
|
||||
spring.rabbitmq.host=10.4.34.24
|
||||
spring.rabbitmq.port=30672
|
||||
spring.rabbitmq.username=liudz
|
||||
spring.rabbitmq.password=qazwsx.c0m
|
||||
spring.rabbitmq.virtual-host=/
|
||||
spring.rabbitmq.listener.simple.concurrency= 10
|
||||
spring.rabbitmq.listener.simple.max-concurrency= 10
|
||||
|
|
|
@ -27,6 +27,6 @@
|
|||
|
||||
<context:component-scan base-package="com.geekq.miaosha" />
|
||||
|
||||
<import resource="classpath:/dubbo_consumer.xml" />
|
||||
<!--<import resource="classpath:/dubbo_consumer.xml" />-->
|
||||
|
||||
</beans>
|
||||
|
|
Loading…
Reference in New Issue
Block a user