提交修改 token 重新生成问题

This commit is contained in:
qiurunze 2018-12-05 11:48:02 +08:00
parent a07f9a4cba
commit c700c1a307
40 changed files with 999 additions and 1054 deletions

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.23">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/embed/tomcat-embed-core/8.5.23/tomcat-embed-core-8.5.23.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/embed/tomcat-embed-core/8.5.23/tomcat-embed-core-8.5.23-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/embed/tomcat-embed-core/8.5.23/tomcat-embed-core-8.5.23-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.23">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.23/tomcat-embed-websocket-8.5.23.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.23/tomcat-embed-websocket-8.5.23-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.23/tomcat-embed-websocket-8.5.23-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.apache.tomcat:tomcat-annotations-api:8.5.23">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/tomcat-annotations-api/8.5.23/tomcat-annotations-api-8.5.23.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/tomcat-annotations-api/8.5.23/tomcat-annotations-api-8.5.23-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/tomcat-annotations-api/8.5.23/tomcat-annotations-api-8.5.23-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.5.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-tomcat/1.5.8.RELEASE/spring-boot-starter-tomcat-1.5.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-tomcat/1.5.8.RELEASE/spring-boot-starter-tomcat-1.5.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-tomcat/1.5.8.RELEASE/spring-boot-starter-tomcat-1.5.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -7,7 +7,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" /> <output url="file://$PROJECT_DIR$/classes" />
</component> </component>
</project> </project>

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@
监控工具:1.nginx_status并发统计,Ngxtop缓存统计 监控工具:1.nginx_status并发统计,Ngxtop缓存统计
### nginx负载均衡 ### nginx负载均衡
![整体流程](http://i2.bvimg.com/601558/23f54a389b2b23e8.png) ![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/miaosha2.png)
### <font color=#0099ff size=3 >8.服务降级--服务熔断(过载保护)</font><br> ### <font color=#0099ff size=3 >8.服务降级--服务熔断(过载保护)</font><br>
@ -97,7 +97,7 @@ redis的数量不是库存,他的作用仅仅只是为了阻挡多余的请求
### <font color=#0099ff size=3 >15.为什么threadlocal存储user对象原理</font><br> ### <font color=#0099ff size=3 >15.为什么threadlocal存储user对象原理</font><br>
![整体流程](http://i2.bvimg.com/601558/3293e36cc2c7e303.png) ![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/miaosha1.png)
1.并发编程中重要的问题就是数据共享,当你在一个线程中改变任意属性时,所有的线程都会因此受到影响,同时会看到第一个线程修改后的值<br> 1.并发编程中重要的问题就是数据共享,当你在一个线程中改变任意属性时,所有的线程都会因此受到影响,同时会看到第一个线程修改后的值<br>
有时我们希望如此,比如:多个线程增大或减小同一个计数器变量<br> 有时我们希望如此,比如:多个线程增大或减小同一个计数器变量<br>

View File

@ -40,23 +40,25 @@
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.25" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.17" level="project" /> <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.5.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.23" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-annotations-api:8.5.23" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.23" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.3.5.Final" level="project" /> <orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.3.5.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" /> <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.1.Final" level="project" /> <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.1.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.10" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.10" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.10" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.12.RELEASE" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.5.8.RELEASE" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.23" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat:tomcat-annotations-api:8.5.23" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.23" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.23" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" /> <orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:1.5.8.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:1.5.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring4:2.1.5.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring4:2.1.5.RELEASE" level="project" />
@ -81,7 +83,6 @@
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" /> <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:1.5.8.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:1.5.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.23" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-amqp:1.5.8.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-amqp:1.5.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-messaging:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-rabbit:1.7.4.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.amqp:spring-rabbit:1.7.4.RELEASE" level="project" />
@ -93,25 +94,6 @@
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-amqp:1.7.4.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.amqp:spring-amqp:1.7.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.3" level="project" /> <orderEntry type="library" name="Maven: joda-time:joda-time:2.3" level="project" />
<orderEntry type="library" name="Maven: org.redisson:redisson:2.14.0" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver-dns:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-dns:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.30.Final" level="project" />
<orderEntry type="library" name="Maven: javax.cache:cache-api:1.0.0" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-stream:2.0.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:2.0.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.reactivex.rxjava2:rxjava:2.1.13" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.10" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.10" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.8.17" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-bean:3.7.1" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-core:3.7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.2" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.2" level="project" />
</component> </component>
</module> </module>

26
pom.xml
View File

@ -46,10 +46,26 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。
相当于compile但是打包阶段做了exclude操作-->
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
@ -123,11 +139,11 @@
<version>2.3</version> <version>2.3</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.redisson/redisson --> <!-- https://mvnrepository.com/artifact/org.redisson/redisson -->
<dependency> <!--<dependency>-->
<groupId>org.redisson</groupId> <!--<groupId>org.redisson</groupId>-->
<artifactId>redisson</artifactId> <!--<artifactId>redisson</artifactId>-->
<version>2.14.0</version> <!--<version>2.14.0</version>-->
</dependency> <!--</dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -11,9 +11,6 @@ import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer; import org.springframework.web.method.support.ModelAndViewContainer;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@Service @Service
public class UserArgumentResolver implements HandlerMethodArgumentResolver { public class UserArgumentResolver implements HandlerMethodArgumentResolver {
@ -41,13 +38,4 @@ public class UserArgumentResolver implements HandlerMethodArgumentResolver {
return UserContext.getUser(); return UserContext.getUser();
} }
private String getCookieValue(HttpServletRequest request, String cookiName) {
Cookie[] cookies = request.getCookies();
for(Cookie cookie : cookies) {
if(cookie.getName().equals(cookiName)) {
return cookie.getValue();
}
}
return null;
}
} }

View File

@ -93,7 +93,7 @@ public class MiaoshaController implements InitializingBean {
return Result.error(CodeMsg.MIAO_SHA_OVER); return Result.error(CodeMsg.MIAO_SHA_OVER);
} }
//预见库存 //预见库存
long stock = redisService.decr(GoodsKey.getMiaoshaGoodsStock,""+goodsId) ; Long stock = redisService.decr(GoodsKey.getMiaoshaGoodsStock,""+goodsId) ;
if(stock <0){ if(stock <0){
localOverMap.put(goodsId, true); localOverMap.put(goodsId, true);
return Result.error(CodeMsg.MIAO_SHA_OVER); return Result.error(CodeMsg.MIAO_SHA_OVER);
@ -162,6 +162,10 @@ public class MiaoshaController implements InitializingBean {
} }
} }
/**
* 系统初始化
* @throws Exception
*/
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
List<GoodsVo> goodsList= goodsService.listGoodsVo(); List<GoodsVo> goodsList= goodsService.listGoodsVo();

View File

@ -1,76 +1,76 @@
package com.geekq.miaosha.redis; //package com.geekq.miaosha.redis;
//
import org.apache.commons.lang3.StringUtils; //import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson; //import org.redisson.Redisson;
import org.redisson.api.RedissonClient; //import org.redisson.api.RedissonClient;
import org.redisson.config.Config; //import org.redisson.config.Config;
import org.redisson.config.SentinelServersConfig; //import org.redisson.config.SentinelServersConfig;
import org.redisson.config.SingleServerConfig; //import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; //import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; //import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
//
@Configuration //@Configuration
@ConditionalOnClass(Config.class) //@ConditionalOnClass(Config.class)
@EnableConfigurationProperties(RedissonProperties.class) //@EnableConfigurationProperties(RedissonProperties.class)
public class RedissonAutoConfiguration { //public class RedissonAutoConfiguration {
//
@Autowired // @Autowired
private RedissonProperties redssionProperties; // private RedissonProperties redssionProperties;
//
/** // /**
* 哨兵模式自动装配 // * 哨兵模式自动装配
* @return // * @return
*/ // */
@Bean // @Bean
@ConditionalOnProperty(name="redisson.master-name") // @ConditionalOnProperty(name="redisson.master-name")
RedissonClient redissonSentinel() { // RedissonClient redissonSentinel() {
Config config = new Config(); // Config config = new Config();
SentinelServersConfig serverConfig = config.useSentinelServers().addSentinelAddress(redssionProperties.getSentinelAddresses()) // SentinelServersConfig serverConfig = config.useSentinelServers().addSentinelAddress(redssionProperties.getSentinelAddresses())
.setMasterName(redssionProperties.getMasterName()) // .setMasterName(redssionProperties.getMasterName())
.setTimeout(redssionProperties.getTimeout()) // .setTimeout(redssionProperties.getTimeout())
.setMasterConnectionPoolSize(redssionProperties.getMasterConnectionPoolSize()) // .setMasterConnectionPoolSize(redssionProperties.getMasterConnectionPoolSize())
.setSlaveConnectionPoolSize(redssionProperties.getSlaveConnectionPoolSize()); // .setSlaveConnectionPoolSize(redssionProperties.getSlaveConnectionPoolSize());
//
if(StringUtils.isNotBlank(redssionProperties.getPassword())) { // if(StringUtils.isNotBlank(redssionProperties.getPassword())) {
serverConfig.setPassword(redssionProperties.getPassword()); // serverConfig.setPassword(redssionProperties.getPassword());
} // }
return Redisson.create(config); // return Redisson.create(config);
} // }
//
/** // /**
* 单机模式自动装配 // * 单机模式自动装配
* @return // * @return
*/ // */
@Bean // @Bean
@ConditionalOnProperty(name="redisson.address") // @ConditionalOnProperty(name="redisson.address")
RedissonClient redissonSingle() { // RedissonClient redissonSingle() {
Config config = new Config(); // Config config = new Config();
SingleServerConfig serverConfig = config.useSingleServer() // SingleServerConfig serverConfig = config.useSingleServer()
.setAddress(redssionProperties.getAddress()) // .setAddress(redssionProperties.getAddress())
.setTimeout(redssionProperties.getTimeout()) // .setTimeout(redssionProperties.getTimeout())
.setConnectionPoolSize(redssionProperties.getConnectionPoolSize()) // .setConnectionPoolSize(redssionProperties.getConnectionPoolSize())
.setConnectionMinimumIdleSize(redssionProperties.getConnectionMinimumIdleSize()); // .setConnectionMinimumIdleSize(redssionProperties.getConnectionMinimumIdleSize());
//
if(StringUtils.isNotBlank(redssionProperties.getPassword())) { // if(StringUtils.isNotBlank(redssionProperties.getPassword())) {
serverConfig.setPassword(redssionProperties.getPassword()); // serverConfig.setPassword(redssionProperties.getPassword());
} // }
//
return Redisson.create(config); // return Redisson.create(config);
} // }
//
/** // /**
* 装配locker类并将实例注入到RedissLockUtil中 // * 装配locker类并将实例注入到RedissLockUtil中
* @return // * @return
*/ // */
@Bean // @Bean
DistributedLocker distributedLocker(RedissonClient redissonSingle) { // DistributedLocker distributedLocker(RedissonClient redissonSingle) {
RedissonDistributedLocker locker = new RedissonDistributedLocker(); // RedissonDistributedLocker locker = new RedissonDistributedLocker();
locker.setRedissonClient(redissonSingle); // locker.setRedissonClient(redissonSingle);
RedissLockUtil.setLocker(locker); // RedissLockUtil.setLocker(locker);
return locker; // return locker;
} // }
} //}

View File

@ -1,39 +1,39 @@
package com.geekq.miaosha.redis; //package com.geekq.miaosha.redis;
//
import org.redisson.api.RLock; //import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; //import org.redisson.api.RedissonClient;
//
import java.util.concurrent.TimeUnit; //import java.util.concurrent.TimeUnit;
//
public class RedissonDistributedLocker implements DistributedLocker { //public class RedissonDistributedLocker implements DistributedLocker {
//
private RedissonClient redissonClient; // private RedissonClient redissonClient;
//
@Override // @Override
public void lock(String lockKey) { // public void lock(String lockKey) {
RLock lock = redissonClient.getLock(lockKey); // RLock lock = redissonClient.getLock(lockKey);
lock.lock(); // lock.lock();
} // }
//
@Override // @Override
public void unlock(String lockKey) { // public void unlock(String lockKey) {
RLock lock = redissonClient.getLock(lockKey); // RLock lock = redissonClient.getLock(lockKey);
lock.unlock(); // lock.unlock();
} // }
//
@Override // @Override
public void lock(String lockKey, int leaseTime) { // public void lock(String lockKey, int leaseTime) {
RLock lock = redissonClient.getLock(lockKey); // RLock lock = redissonClient.getLock(lockKey);
lock.lock(leaseTime, TimeUnit.SECONDS); // lock.lock(leaseTime, TimeUnit.SECONDS);
} // }
//
@Override // @Override
public void lock(String lockKey, TimeUnit unit ,int timeout) { // public void lock(String lockKey, TimeUnit unit ,int timeout) {
RLock lock = redissonClient.getLock(lockKey); // RLock lock = redissonClient.getLock(lockKey);
lock.lock(timeout, unit); // lock.lock(timeout, unit);
} // }
//
public void setRedissonClient(RedissonClient redissonClient) { // public void setRedissonClient(RedissonClient redissonClient) {
this.redissonClient = redissonClient; // this.redissonClient = redissonClient;
} // }
} //}

View File

@ -1,98 +1,98 @@
package com.geekq.miaosha.redis; //package com.geekq.miaosha.redis;
//
import org.springframework.boot.context.properties.ConfigurationProperties; //import org.springframework.boot.context.properties.ConfigurationProperties;
//
@ConfigurationProperties(prefix = "redisson") //@ConfigurationProperties(prefix = "redisson")
public class RedissonProperties { //public class RedissonProperties {
//
private int timeout = 3000; // private int timeout = 3000;
//
private String address; // private String address;
//
private String password; // private String password;
//
private int connectionPoolSize = 64; // private int connectionPoolSize = 64;
//
private int connectionMinimumIdleSize=10; // private int connectionMinimumIdleSize=10;
//
private int slaveConnectionPoolSize = 250; // private int slaveConnectionPoolSize = 250;
//
private int masterConnectionPoolSize = 250; // private int masterConnectionPoolSize = 250;
//
private String[] sentinelAddresses; // private String[] sentinelAddresses;
//
private String masterName; // private String masterName;
//
public int getTimeout() { // public int getTimeout() {
return timeout; // return timeout;
} // }
//
public void setTimeout(int timeout) { // public void setTimeout(int timeout) {
this.timeout = timeout; // this.timeout = timeout;
} // }
//
public int getSlaveConnectionPoolSize() { // public int getSlaveConnectionPoolSize() {
return slaveConnectionPoolSize; // return slaveConnectionPoolSize;
} // }
//
public void setSlaveConnectionPoolSize(int slaveConnectionPoolSize) { // public void setSlaveConnectionPoolSize(int slaveConnectionPoolSize) {
this.slaveConnectionPoolSize = slaveConnectionPoolSize; // this.slaveConnectionPoolSize = slaveConnectionPoolSize;
} // }
//
public int getMasterConnectionPoolSize() { // public int getMasterConnectionPoolSize() {
return masterConnectionPoolSize; // return masterConnectionPoolSize;
} // }
//
public void setMasterConnectionPoolSize(int masterConnectionPoolSize) { // public void setMasterConnectionPoolSize(int masterConnectionPoolSize) {
this.masterConnectionPoolSize = masterConnectionPoolSize; // this.masterConnectionPoolSize = masterConnectionPoolSize;
} // }
//
public String[] getSentinelAddresses() { // public String[] getSentinelAddresses() {
return sentinelAddresses; // return sentinelAddresses;
} // }
//
public void setSentinelAddresses(String sentinelAddresses) { // public void setSentinelAddresses(String sentinelAddresses) {
this.sentinelAddresses = sentinelAddresses.split(","); // this.sentinelAddresses = sentinelAddresses.split(",");
} // }
//
public String getMasterName() { // public String getMasterName() {
return masterName; // return masterName;
} // }
//
public void setMasterName(String masterName) { // public void setMasterName(String masterName) {
this.masterName = masterName; // this.masterName = masterName;
} // }
//
public String getPassword() { // public String getPassword() {
return password; // return password;
} // }
//
public void setPassword(String password) { // public void setPassword(String password) {
this.password = password; // this.password = password;
} // }
//
public String getAddress() { // public String getAddress() {
return address; // return address;
} // }
//
public void setAddress(String address) { // public void setAddress(String address) {
this.address = address; // this.address = address;
} // }
//
public int getConnectionPoolSize() { // public int getConnectionPoolSize() {
return connectionPoolSize; // return connectionPoolSize;
} // }
//
public void setConnectionPoolSize(int connectionPoolSize) { // public void setConnectionPoolSize(int connectionPoolSize) {
this.connectionPoolSize = connectionPoolSize; // this.connectionPoolSize = connectionPoolSize;
} // }
//
public int getConnectionMinimumIdleSize() { // public int getConnectionMinimumIdleSize() {
return connectionMinimumIdleSize; // return connectionMinimumIdleSize;
} // }
//
public void setConnectionMinimumIdleSize(int connectionMinimumIdleSize) { // public void setConnectionMinimumIdleSize(int connectionMinimumIdleSize) {
this.connectionMinimumIdleSize = connectionMinimumIdleSize; // this.connectionMinimumIdleSize = connectionMinimumIdleSize;
} // }
} //}
//

View File

@ -1,146 +1,146 @@
package com.geekq.miaosha.redis; //package com.geekq.miaosha.redis;
//
import org.redisson.api.*; //import org.redisson.api.*;
import org.redisson.config.Config; //import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.io.IOException; //import java.io.IOException;
//
/** ///**
* redisson操作类 // * redisson操作类
*/ // */
@Service("redissonService") //@Service("redissonService")
public class RedissonService { //public class RedissonService {
//
@Autowired // @Autowired
private RedissonClient redissonClient; // private RedissonClient redissonClient;
//
public void getRedissonClient() throws IOException { // public void getRedissonClient() throws IOException {
Config config = redissonClient.getConfig(); // Config config = redissonClient.getConfig();
System.out.println(config.toJSON().toString()); // System.out.println(config.toJSON().toString());
} // }
//
/**` // /**`
* 获取字符串对象 // * 获取字符串对象
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public <T> RBucket<T> getRBucket(String objectName) { // public <T> RBucket<T> getRBucket(String objectName) {
RBucket<T> bucket = redissonClient.getBucket(objectName); // RBucket<T> bucket = redissonClient.getBucket(objectName);
return bucket; // return bucket;
} // }
//
/** // /**
* 获取Map对象 // * 获取Map对象
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public <K, V> RMap<K, V> getRMap(String objectName) { // public <K, V> RMap<K, V> getRMap(String objectName) {
RMap<K, V> map = redissonClient.getMap(objectName); // RMap<K, V> map = redissonClient.getMap(objectName);
return map; // return map;
} // }
//
/** // /**
* 获取有序集合 // * 获取有序集合
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public <V> RSortedSet<V> getRSortedSet(String objectName) { // public <V> RSortedSet<V> getRSortedSet(String objectName) {
RSortedSet<V> sortedSet = redissonClient.getSortedSet(objectName); // RSortedSet<V> sortedSet = redissonClient.getSortedSet(objectName);
return sortedSet; // return sortedSet;
} // }
//
/** // /**
* 获取集合 // * 获取集合
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public <V> RSet<V> getRSet(String objectName) { // public <V> RSet<V> getRSet(String objectName) {
RSet<V> rSet = redissonClient.getSet(objectName); // RSet<V> rSet = redissonClient.getSet(objectName);
return rSet; // return rSet;
} // }
//
/** // /**
* 获取列表 // * 获取列表
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public <V> RList<V> getRList(String objectName) { // public <V> RList<V> getRList(String objectName) {
RList<V> rList = redissonClient.getList(objectName); // RList<V> rList = redissonClient.getList(objectName);
return rList; // return rList;
} // }
//
/** // /**
* 获取队列 // * 获取队列
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public <V> RQueue<V> getRQueue(String objectName) { // public <V> RQueue<V> getRQueue(String objectName) {
RQueue<V> rQueue = redissonClient.getQueue(objectName); // RQueue<V> rQueue = redissonClient.getQueue(objectName);
return rQueue; // return rQueue;
} // }
//
/** // /**
* 获取双端队列 // * 获取双端队列
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public <V> RDeque<V> getRDeque(String objectName) { // public <V> RDeque<V> getRDeque(String objectName) {
RDeque<V> rDeque = redissonClient.getDeque(objectName); // RDeque<V> rDeque = redissonClient.getDeque(objectName);
return rDeque; // return rDeque;
} // }
//
//
/** // /**
* 获取锁 // * 获取锁
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public RLock getRLock(String objectName) { // public RLock getRLock(String objectName) {
RLock rLock = redissonClient.getLock(objectName); // RLock rLock = redissonClient.getLock(objectName);
return rLock; // return rLock;
} // }
//
/** // /**
* 获取读取锁 // * 获取读取锁
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public RReadWriteLock getRWLock(String objectName) { // public RReadWriteLock getRWLock(String objectName) {
RReadWriteLock rwlock = redissonClient.getReadWriteLock(objectName); // RReadWriteLock rwlock = redissonClient.getReadWriteLock(objectName);
return rwlock; // return rwlock;
} // }
//
/** // /**
* 获取原子数 // * 获取原子数
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public RAtomicLong getRAtomicLong(String objectName) { // public RAtomicLong getRAtomicLong(String objectName) {
RAtomicLong rAtomicLong = redissonClient.getAtomicLong(objectName); // RAtomicLong rAtomicLong = redissonClient.getAtomicLong(objectName);
return rAtomicLong; // return rAtomicLong;
} // }
//
/** // /**
* 获取记数锁 // * 获取记数锁
* // *
* @param objectName // * @param objectName
* @return // * @return
*/ // */
public RCountDownLatch getRCountDownLatch(String objectName) { // public RCountDownLatch getRCountDownLatch(String objectName) {
RCountDownLatch rCountDownLatch = redissonClient.getCountDownLatch(objectName); // RCountDownLatch rCountDownLatch = redissonClient.getCountDownLatch(objectName);
return rCountDownLatch; // return rCountDownLatch;
} // }
//
} //}

View File

@ -37,7 +37,7 @@ public class MiaoShaUserService {
} }
MiaoshaUser user =redisService.get(MiaoShaUserKey.token,token,MiaoshaUser.class) ; MiaoshaUser user =redisService.get(MiaoShaUserKey.token,token,MiaoshaUser.class) ;
if(user!=null) { if(user!=null) {
addCookie(response, user); addCookie(response, token, user);
} }
return user ; return user ;
@ -105,17 +105,25 @@ public class MiaoShaUserService {
if(!calcPass.equals(dbPass)){ if(!calcPass.equals(dbPass)){
throw new GlobleException(CodeMsg.PASSWORD_ERROR); throw new GlobleException(CodeMsg.PASSWORD_ERROR);
} }
//生成cookie //生成cookie
addCookie(response,user); String token= UUIDUtil.uuid();
addCookie(response, token, user);
return true ; return true ;
} }
private void addCookie(HttpServletResponse response ,MiaoshaUser user){ private void addCookie(HttpServletResponse response, String token, MiaoshaUser user) {
String token = UUIDUtil.uuid(); redisService.set(MiaoShaUserKey.token, token, user);
redisService.set(MiaoShaUserKey.token,token,user) ; Cookie cookie = new Cookie(COOKIE_NAME_TOKEN, token);
Cookie cookie = new Cookie(COOKIE_NAME_TOKEN , token) ;
cookie.setMaxAge(MiaoShaUserKey.token.expireSeconds()); cookie.setMaxAge(MiaoShaUserKey.token.expireSeconds());
cookie.setPath("/"); cookie.setPath("/");
response.addCookie(cookie); response.addCookie(cookie);
} }
// private void addCookie(HttpServletResponse response ,MiaoshaUser user){
// String token = UUIDUtil.uuid();
// redisService.set(MiaoShaUserKey.token,token,user) ;
// Cookie cookie = new Cookie(COOKIE_NAME_TOKEN , token) ;
// cookie.setMaxAge(MiaoShaUserKey.token.expireSeconds());
// cookie.setPath("/");
// response.addCookie(cookie);
// }
} }

View File

@ -1,114 +1,114 @@
package com.geekq.miaosha.timeTask; //package com.geekq.miaosha.timeTask;
import com.geekq.miaosha.dao.OrderDao;
import com.geekq.miaosha.redis.RedisService;
import com.geekq.miaosha.redis.RedissonService;
import com.geekq.miaosha.service.OrderService;
import jodd.util.PropertiesUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
import static com.geekq.miaosha.common.Constanst.CLOSE_ORDER_INFO_TASK_LOCK;
@Component
@Slf4j
public class OrderCloseTask {
@Autowired
private OrderDao orderDao ;
@Autowired
private RedisService redisService;
@Autowired
private OrderService orderService;
@Autowired
private RedissonService redissonService;
// @Scheduled(cron = "0/1 * * * * ?")
private void closeOrderTaskv1(){
int hour = 2;
orderService.closeOrder(hour);
log.info("关闭订单定时任务结束");
}
// @Scheduled(cron = "0/1 * * * * ?")
// public void closeOrderTaskV2(){
// log.info("关闭订单定时任务启动");
// long lockTime = 5000;
// Long setnxResult = redisService.setnx(CLOSE_ORDER_INFO_TASK_LOCK,String.valueOf(System.currentTimeMillis()+lockTime));
// //代表获取了锁
// if(setnxResult !=null && setnxResult ==1){
// closeOrder(CLOSE_ORDER_INFO_TASK_LOCK);
// }else {
// log.info("没有获得分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK);
// }
// log.info("关闭订单定时任务结束");
// }
// @Scheduled(cron = "0/1 * * * * ?")
// public void closeOrderTaskV3(){
// log.info("关闭订单定时任务启动");
// long lockTime = 5000;
// Long setnxResult = redisService.setnx(CLOSE_ORDER_INFO_TASK_LOCK,String.valueOf(System.currentTimeMillis()+lockTime));
// //代表获取了锁
// if(setnxResult !=null && setnxResult ==1){
// closeOrder(CLOSE_ORDER_INFO_TASK_LOCK);
// }else {
// log.info("没有获得分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK);
// String lockValueStr = redisService.get(CLOSE_ORDER_INFO_TASK_LOCK);
// if(lockValueStr!=null&&System.currentTimeMillis() > Long.parseLong(lockValueStr)){
// //把之前的释放在新加入锁
// String getSetResult = redisService.getset(CLOSE_ORDER_INFO_TASK_LOCK,String.valueOf(System.currentTimeMillis()+lockTime));
// //
// if(getSetResult == null || (getSetResult != null && StringUtils.equals(lockValueStr,getSetResult))){ //import com.geekq.miaosha.dao.OrderDao;
// closeOrder(CLOSE_ORDER_INFO_TASK_LOCK); //import com.geekq.miaosha.redis.RedisService;
// }else { //import com.geekq.miaosha.redis.RedissonService;
// log.info("没有获取到分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK); //import com.geekq.miaosha.service.OrderService;
// } //import jodd.util.PropertiesUtil;
// }else { //import lombok.extern.slf4j.Slf4j;
// log.info("没有获取到分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK); //import org.apache.commons.lang3.StringUtils;
// } //import org.redisson.api.RLock;
// } //import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import java.util.concurrent.TimeUnit;
//
//import static com.geekq.miaosha.common.Constanst.CLOSE_ORDER_INFO_TASK_LOCK;
//
//@Component
//@Slf4j
//public class OrderCloseTask {
//
// @Autowired
// private OrderDao orderDao ;
// @Autowired
// private RedisService redisService;
//
// @Autowired
// private OrderService orderService;
// @Autowired
// private RedissonService redissonService;
//
//
//// @Scheduled(cron = "0/1 * * * * ?")
// private void closeOrderTaskv1(){
// int hour = 2;
// orderService.closeOrder(hour);
// log.info("关闭订单定时任务结束"); // log.info("关闭订单定时任务结束");
// } // }
@Scheduled(cron="0 */1 * * * ?") //// @Scheduled(cron = "0/1 * * * * ?")
public void closeOrderTaskV4(){ //// public void closeOrderTaskV2(){
RLock lock = redissonService.getRLock(CLOSE_ORDER_INFO_TASK_LOCK); //// log.info("关闭订单定时任务启动");
boolean getLock = false; //// long lockTime = 5000;
try { //// Long setnxResult = redisService.setnx(CLOSE_ORDER_INFO_TASK_LOCK,String.valueOf(System.currentTimeMillis()+lockTime));
if(getLock = lock.tryLock(0,50, TimeUnit.SECONDS)){ //// //代表获取了锁
log.info("Redisson获取到分布式锁:{},ThreadName:{}",CLOSE_ORDER_INFO_TASK_LOCK,Thread.currentThread().getName()); //// if(setnxResult !=null && setnxResult ==1){
int hour = 2; //// closeOrder(CLOSE_ORDER_INFO_TASK_LOCK);
// iOrderService.closeOrder(hour); //// }else {
}else{ //// log.info("没有获得分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK);
log.info("Redisson没有获取到分布式锁:{},ThreadName:{}",CLOSE_ORDER_INFO_TASK_LOCK,Thread.currentThread().getName()); //// }
} //// log.info("关闭订单定时任务结束");
} catch (InterruptedException e) { //// }
log.error("Redisson分布式锁获取异常",e); //
} finally { //// @Scheduled(cron = "0/1 * * * * ?")
if(!getLock){ //// public void closeOrderTaskV3(){
return; //// log.info("关闭订单定时任务启动");
} //// long lockTime = 5000;
lock.unlock(); //// Long setnxResult = redisService.setnx(CLOSE_ORDER_INFO_TASK_LOCK,String.valueOf(System.currentTimeMillis()+lockTime));
log.info("Redisson分布式锁释放锁"); //// //代表获取了锁
} //// if(setnxResult !=null && setnxResult ==1){
} //// closeOrder(CLOSE_ORDER_INFO_TASK_LOCK);
//// }else {
//// log.info("没有获得分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK);
//// String lockValueStr = redisService.get(CLOSE_ORDER_INFO_TASK_LOCK);
private void closeOrder(String lockName){ //// if(lockValueStr!=null&&System.currentTimeMillis() > Long.parseLong(lockValueStr)){
redisService.expire(lockName,5); //// //把之前的释放在新加入锁
log.info("获取{},当前线程名称!" ,lockName,Thread.currentThread().getName()); //// String getSetResult = redisService.getset(CLOSE_ORDER_INFO_TASK_LOCK,String.valueOf(System.currentTimeMillis()+lockTime));
int hour = 2; ////
orderService.closeOrder(hour); //// if(getSetResult == null || (getSetResult != null && StringUtils.equals(lockValueStr,getSetResult))){
redisService.del(CLOSE_ORDER_INFO_TASK_LOCK); //// closeOrder(CLOSE_ORDER_INFO_TASK_LOCK);
log.info("==============================="); //// }else {
//// log.info("没有获取到分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK);
} //// }
} //// }else {
//// log.info("没有获取到分布式锁:{}",CLOSE_ORDER_INFO_TASK_LOCK);
//// }
//// }
//// log.info("关闭订单定时任务结束");
//// }
//// @Scheduled(cron="0 */1 * * * ?")
//// public void closeOrderTaskV4(){
//// RLock lock = redissonService.getRLock(CLOSE_ORDER_INFO_TASK_LOCK);
//// boolean getLock = false;
//// try {
//// if(getLock = lock.tryLock(0,50, TimeUnit.SECONDS)){
//// log.info("Redisson获取到分布式锁:{},ThreadName:{}",CLOSE_ORDER_INFO_TASK_LOCK,Thread.currentThread().getName());
//// int hour = 2;
////// iOrderService.closeOrder(hour);
//// }else{
//// log.info("Redisson没有获取到分布式锁:{},ThreadName:{}",CLOSE_ORDER_INFO_TASK_LOCK,Thread.currentThread().getName());
//// }
//// } catch (InterruptedException e) {
//// log.error("Redisson分布式锁获取异常",e);
//// } finally {
//// if(!getLock){
//// return;
//// }
//// lock.unlock();
//// log.info("Redisson分布式锁释放锁");
//// }
//// }
//
//
//
// private void closeOrder(String lockName){
// redisService.expire(lockName,5);
// log.info("获取{},当前线程名称!" ,lockName,Thread.currentThread().getName());
// int hour = 2;
// orderService.closeOrder(hour);
// redisService.del(CLOSE_ORDER_INFO_TASK_LOCK);
// log.info("===============================");
//
// }
//}

View File

@ -16,9 +16,9 @@ mybatis.mapperLocations=classpath:mybatis/mapper/*.xml
#add mybatis #add mybatis
mybatis.config-locations=classpath:mybatis/config.xml mybatis.config-locations=classpath:mybatis/config.xml
#datasource #datasource
spring.datasource.url=jdbc:mysql://localhost:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false spring.datasource.url=jdbc:mysql://39.107.245.253:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=aixiyue11 spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#druid #druid
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
@ -44,7 +44,7 @@ spring.resources.chain.gzipped=true
spring.resources.chain.html-application-cache=true spring.resources.chain.html-application-cache=true
spring.resources.static-locations=classpath:/static/ spring.resources.static-locations=classpath:/static/
#redis #redis
redis.host=192.168.1.116 redis.host=39.107.245.253
redis.port=6379 redis.port=6379
redis.timeout=100 redis.timeout=100
redis.password=123456 redis.password=123456
@ -54,10 +54,10 @@ redis.poolMaxWait=500
#server.port=8003 #server.port=8003
#rabbitmq #rabbitmq
spring.rabbitmq.host=localhost spring.rabbitmq.host=39.107.245.253
spring.rabbitmq.port=5672 spring.rabbitmq.port=5672
spring.rabbitmq.username=guest spring.rabbitmq.username=mqadmin
spring.rabbitmq.password=guest spring.rabbitmq.password=mqadmin
spring.rabbitmq.virtual-host=/ spring.rabbitmq.virtual-host=/
spring.rabbitmq.listener.simple.concurrency= 10 spring.rabbitmq.listener.simple.concurrency= 10
spring.rabbitmq.listener.simple.max-concurrency= 10 spring.rabbitmq.listener.simple.max-concurrency= 10
@ -71,4 +71,4 @@ spring.rabbitmq.template.retry.max-interval=10000
spring.rabbitmq.template.retry.multiplier=1.0 spring.rabbitmq.template.retry.multiplier=1.0
## maven隔离 ## maven隔离
spring.profiles.active=dev #spring.profiles.active=dev

View File

@ -16,9 +16,9 @@ mybatis.mapperLocations=classpath:mybatis/mapper/*.xml
#add mybatis #add mybatis
mybatis.config-locations=classpath:mybatis/config.xml mybatis.config-locations=classpath:mybatis/config.xml
#datasource #datasource
spring.datasource.url=jdbc:mysql://localhost:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false spring.datasource.url=jdbc:mysql://39.107.245.253:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=aixiyue11 spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#druid #druid
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
@ -44,7 +44,7 @@ spring.resources.chain.gzipped=true
spring.resources.chain.html-application-cache=true spring.resources.chain.html-application-cache=true
spring.resources.static-locations=classpath:/static/ spring.resources.static-locations=classpath:/static/
#redis #redis
redis.host=192.168.1.116 redis.host=39.107.245.253
redis.port=6379 redis.port=6379
redis.timeout=100 redis.timeout=100
redis.password=123456 redis.password=123456
@ -54,10 +54,10 @@ redis.poolMaxWait=500
#server.port=8003 #server.port=8003
#rabbitmq #rabbitmq
spring.rabbitmq.host=localhost spring.rabbitmq.host=39.107.245.253
spring.rabbitmq.port=5672 spring.rabbitmq.port=5672
spring.rabbitmq.username=guest spring.rabbitmq.username=mqadmin
spring.rabbitmq.password=guest spring.rabbitmq.password=mqadmin
spring.rabbitmq.virtual-host=/ spring.rabbitmq.virtual-host=/
spring.rabbitmq.listener.simple.concurrency= 10 spring.rabbitmq.listener.simple.concurrency= 10
spring.rabbitmq.listener.simple.max-concurrency= 10 spring.rabbitmq.listener.simple.max-concurrency= 10
@ -71,4 +71,4 @@ spring.rabbitmq.template.retry.max-interval=10000
spring.rabbitmq.template.retry.multiplier=1.0 spring.rabbitmq.template.retry.multiplier=1.0
## maven隔离 ## maven隔离
spring.profiles.active=dev #spring.profiles.active=dev