mirror of
https://github.com/qiurunze123/miaosha.git
synced 2023-11-19 22:41:03 +08:00
提交 lombok 与 maven 隔离!
This commit is contained in:
parent
55fbc8d08d
commit
87c7ac9ca9
|
@ -125,4 +125,5 @@ redis的数量不是库存,他的作用仅仅只是为了阻挡多余的请求
|
||||||
|
|
||||||
### <font color=#0099ff size=3 >15.mybatis如何使用注解与xml配置?</font><br>
|
### <font color=#0099ff size=3 >15.mybatis如何使用注解与xml配置?</font><br>
|
||||||
本文使用的是注解方法开发所以不做过多解释<br>
|
本文使用的是注解方法开发所以不做过多解释<br>
|
||||||
下面仔细讲解以下如何详细使用xml开发<br>
|
下面仔细讲解以下如何详细使用xml开发在目录里面有一个与本文无挂的类似于微信自动回复的功能br>
|
||||||
|
里面有mybatis的全部解析和用法,大家可以简单的当做一个demo来使用<br>
|
||||||
|
|
12
miaosha.iml
12
miaosha.iml
|
@ -20,6 +20,15 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:dubbo:2.5.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.netty:netty:3.2.5.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty:3.7.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.5.8.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.5.8.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.8.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.8.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.8.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.8.RELEASE" level="project" />
|
||||||
|
@ -54,9 +63,7 @@
|
||||||
<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" />
|
||||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:2.1.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:2.1.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: ognl:ognl:3.0.8" level="project" />
|
<orderEntry type="library" name="Maven: ognl:ognl:3.0.8" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.0.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.0.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:1.4.0" level="project" />
|
<orderEntry type="library" name="Maven: nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:1.4.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy:2.4.12" level="project" />
|
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy:2.4.12" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1" level="project" />
|
||||||
|
@ -86,5 +93,6 @@
|
||||||
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.1.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.1.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.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" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.2" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
99
pom.xml
99
pom.xml
|
@ -19,7 +19,33 @@
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>dubbo</artifactId>
|
||||||
|
<version>2.5.3</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.zookeeper</groupId>
|
||||||
|
<artifactId>zookeeper</artifactId>
|
||||||
|
<version>3.4.6</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
|
||||||
|
</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>
|
||||||
|
@ -96,6 +122,14 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--lombook引用-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -105,6 +139,23 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>1.5.2.RELEASE</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.geekq.miaosha.GeekQMainApplication</mainClass><!--springboot启动类目录-->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals> <!--创建一个自动可执行的jar或war文件 -->
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -113,7 +164,55 @@
|
||||||
<include>**/*.xml</include>
|
<include>**/*.xml</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
|
|
||||||
|
<resource> <!--配置文件路径 -->
|
||||||
|
<directory>src/main/resources</directory> <!--这里对应项目存放配置文件的目录--> <!--开启filtering功能 -->
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<excludes>
|
||||||
|
<exclude>application.properties</exclude>
|
||||||
|
<exclude>application-dev.properties</exclude>
|
||||||
|
<exclude>application-prod.properties</exclude>
|
||||||
|
<exclude>application-test.properties</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<resource> <!--配置文件路径 -->
|
||||||
|
<directory>src/main/resources</directory> <!--这里对应项目存放配置文件的目录--> <!--开启filtering功能 -->
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>application-${activatedProperties}.properties</include>
|
||||||
|
<include>application.properties</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>dev</id>
|
||||||
|
<properties> <!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||||
|
<activatedProperties>dev</activatedProperties>
|
||||||
|
</properties>
|
||||||
|
<activation> <!-- 默认环境 -->
|
||||||
|
<activeByDefault>true</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>test</id>
|
||||||
|
<properties>
|
||||||
|
<activatedProperties>test</activatedProperties>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>prod</id>
|
||||||
|
<properties>
|
||||||
|
<activatedProperties>prod</activatedProperties>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,10 +4,10 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class GeekQMainApplication {
|
public class GeekQMainApplication {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
SpringApplication.run(GeekQMainApplication.class, args);
|
SpringApplication.run(GeekQMainApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,72 @@
|
||||||
package com.geekq.miaosha;
|
package com.geekq.miaosha;
|
||||||
|
|
||||||
import com.geekq.miaosha.domain.MiaoshaUser;
|
import java.util.ArrayList;
|
||||||
import org.apache.ibatis.io.Resources;
|
import java.util.List;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
|
||||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Reader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mybatis xml 写法的配置测试类
|
* mybatis xml 写法的配置测试类
|
||||||
*/
|
*/
|
||||||
public class Test {
|
public class Test {
|
||||||
public static void main(String[] args) throws IOException {
|
public static List<Double> list = new ArrayList<Double>();
|
||||||
|
|
||||||
//读取配置文件
|
public static void main(String[] args) {
|
||||||
Reader reader = Resources.getResourceAsReader("config.xml");
|
double[] keys = {1, 2,3};
|
||||||
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(reader);
|
System.err.println(getNum(keys, 5));
|
||||||
|
|
||||||
|
|
||||||
SqlSession session = sessionFactory.openSession();
|
// 举例:3 个元素:a, b, c。所以有2 ^ 3 = 8 个组合结果:所以i = 0, 1, 2,....7.对应应输出 a, b, ab, c...abc(注意a表示001,不是100.)
|
||||||
|
//
|
||||||
|
// 将i变成2进制:
|
||||||
|
// i = 1 = 001
|
||||||
|
// i = 2 = 010
|
||||||
|
// i = 3 = 011
|
||||||
|
//
|
||||||
|
// (1) j = 0 (1) j = 0 (1) j = 0
|
||||||
|
// 移1位:1 << j == 001 1 << j == 001 1 << j == 001
|
||||||
|
// 和i = 001 相与,两个位都为1,返回1 与i无相同位 和i = 001 相与,两个位都为1,返回1
|
||||||
|
// 输出:a 输出a
|
||||||
|
//
|
||||||
|
// (2) j = 1 (2) j = 1 (2) j = 1
|
||||||
|
// 再移一位:1 << j == 010 1 << j == 010 1 << j == 010
|
||||||
|
// 与i = 001 相与。无相同1 和i相与,两个位都为1,返回1 和i相与,两个位都为1,返回1
|
||||||
|
// 输出b 输出b
|
||||||
|
//
|
||||||
|
// (3) j = 2 3)j = 2 (3) j = 2
|
||||||
|
// 移一位 1 << j == 100 1 << j == 100
|
||||||
|
// 与i无相同位 与i无相同位 与i无相同位
|
||||||
|
//
|
||||||
|
// 所以i = 001, 只输出a.所以i = 010, 只输出b.所以011,输出ab
|
||||||
|
//
|
||||||
|
// *************************************
|
||||||
|
// *可见上面每一个数字i, 只会判断判断3次,因为只需要移三次位,二进制就遍历完了
|
||||||
|
|
||||||
String statement = "com.geekq.miaosha.dao.UserMapper.getMiaoShaUserById" ;
|
|
||||||
MiaoshaUser user = session.selectOne(statement,"18612766134");
|
|
||||||
|
|
||||||
System.out.println(user.toString());
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
static List<Double> getNum(double[] keys, double kill) {
|
||||||
|
int n = keys.length;//数字长度
|
||||||
|
System.out.println(n);
|
||||||
|
int nbit = 1 << n; // 8
|
||||||
|
System.out.println(nbit);
|
||||||
|
double in;
|
||||||
|
List<Double> list = new ArrayList<Double>();
|
||||||
|
for (int i = 0; i < nbit; i++) {
|
||||||
|
System.out.println("nbit======="+i);
|
||||||
|
in = 0;
|
||||||
|
list.clear();
|
||||||
|
for (int j = 0; j < n; j++) {
|
||||||
|
System.out.println("j======"+j);
|
||||||
|
int tmp = 1 << j; // 由0到n右移位
|
||||||
|
System.out.println("tmp===="+tmp);
|
||||||
|
if ((tmp & i) != 0) { // 与运算,同为1时才会是1
|
||||||
|
System.out.println("keys[j]=========="+keys[j]);
|
||||||
|
in += keys[j];
|
||||||
|
list.add(keys[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in == kill){
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,14 @@
|
||||||
package com.geekq.miaosha.domain;
|
package com.geekq.miaosha.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class Goods {
|
public class Goods {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String goodsName;
|
private String goodsName;
|
||||||
|
@ -8,46 +17,4 @@ public class Goods {
|
||||||
private String goodsDetail;
|
private String goodsDetail;
|
||||||
private Double goodsPrice;
|
private Double goodsPrice;
|
||||||
private Integer goodsStock;
|
private Integer goodsStock;
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getGoodsName() {
|
|
||||||
return goodsName;
|
|
||||||
}
|
|
||||||
public void setGoodsName(String goodsName) {
|
|
||||||
this.goodsName = goodsName;
|
|
||||||
}
|
|
||||||
public String getGoodsTitle() {
|
|
||||||
return goodsTitle;
|
|
||||||
}
|
|
||||||
public void setGoodsTitle(String goodsTitle) {
|
|
||||||
this.goodsTitle = goodsTitle;
|
|
||||||
}
|
|
||||||
public String getGoodsImg() {
|
|
||||||
return goodsImg;
|
|
||||||
}
|
|
||||||
public void setGoodsImg(String goodsImg) {
|
|
||||||
this.goodsImg = goodsImg;
|
|
||||||
}
|
|
||||||
public String getGoodsDetail() {
|
|
||||||
return goodsDetail;
|
|
||||||
}
|
|
||||||
public void setGoodsDetail(String goodsDetail) {
|
|
||||||
this.goodsDetail = goodsDetail;
|
|
||||||
}
|
|
||||||
public Double getGoodsPrice() {
|
|
||||||
return goodsPrice;
|
|
||||||
}
|
|
||||||
public void setGoodsPrice(Double goodsPrice) {
|
|
||||||
this.goodsPrice = goodsPrice;
|
|
||||||
}
|
|
||||||
public Integer getGoodsStock() {
|
|
||||||
return goodsStock;
|
|
||||||
}
|
|
||||||
public void setGoodsStock(Integer goodsStock) {
|
|
||||||
this.goodsStock = goodsStock;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,20 @@
|
||||||
package com.geekq.miaosha.domain;
|
package com.geekq.miaosha.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class MiaoshaGoods {
|
public class MiaoshaGoods {
|
||||||
private Long id;
|
private Long id;
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
private Integer stockCount;
|
private Integer stockCount;
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public Long getGoodsId() {
|
|
||||||
return goodsId;
|
|
||||||
}
|
|
||||||
public void setGoodsId(Long goodsId) {
|
|
||||||
this.goodsId = goodsId;
|
|
||||||
}
|
|
||||||
public Integer getStockCount() {
|
|
||||||
return stockCount;
|
|
||||||
}
|
|
||||||
public void setStockCount(Integer stockCount) {
|
|
||||||
this.stockCount = stockCount;
|
|
||||||
}
|
|
||||||
public Date getStartDate() {
|
|
||||||
return startDate;
|
|
||||||
}
|
|
||||||
public void setStartDate(Date startDate) {
|
|
||||||
this.startDate = startDate;
|
|
||||||
}
|
|
||||||
public Date getEndDate() {
|
|
||||||
return endDate;
|
|
||||||
}
|
|
||||||
public void setEndDate(Date endDate) {
|
|
||||||
this.endDate = endDate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,17 @@
|
||||||
package com.geekq.miaosha.domain;
|
package com.geekq.miaosha.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class MiaoshaOrder {
|
public class MiaoshaOrder {
|
||||||
private Long id;
|
private Long id;
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public Long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
public void setUserId(Long userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
public Long getOrderId() {
|
|
||||||
return orderId;
|
|
||||||
}
|
|
||||||
public void setOrderId(Long orderId) {
|
|
||||||
this.orderId = orderId;
|
|
||||||
}
|
|
||||||
public Long getGoodsId() {
|
|
||||||
return goodsId;
|
|
||||||
}
|
|
||||||
public void setGoodsId(Long goodsId) {
|
|
||||||
this.goodsId = goodsId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
package com.geekq.miaosha.domain;
|
package com.geekq.miaosha.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class MiaoshaUser {
|
public class MiaoshaUser {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String nickname;
|
private String nickname;
|
||||||
|
@ -11,55 +20,6 @@ public class MiaoshaUser {
|
||||||
private Date registerDate;
|
private Date registerDate;
|
||||||
private Date lastLoginDate;
|
private Date lastLoginDate;
|
||||||
private Integer loginCount;
|
private Integer loginCount;
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getNickname() {
|
|
||||||
return nickname;
|
|
||||||
}
|
|
||||||
public void setNickname(String nickname) {
|
|
||||||
this.nickname = nickname;
|
|
||||||
}
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
public String getSalt() {
|
|
||||||
return salt;
|
|
||||||
}
|
|
||||||
public void setSalt(String salt) {
|
|
||||||
this.salt = salt;
|
|
||||||
}
|
|
||||||
public String getHead() {
|
|
||||||
return head;
|
|
||||||
}
|
|
||||||
public void setHead(String head) {
|
|
||||||
this.head = head;
|
|
||||||
}
|
|
||||||
public Date getRegisterDate() {
|
|
||||||
return registerDate;
|
|
||||||
}
|
|
||||||
public void setRegisterDate(Date registerDate) {
|
|
||||||
this.registerDate = registerDate;
|
|
||||||
}
|
|
||||||
public Date getLastLoginDate() {
|
|
||||||
return lastLoginDate;
|
|
||||||
}
|
|
||||||
public void setLastLoginDate(Date lastLoginDate) {
|
|
||||||
this.lastLoginDate = lastLoginDate;
|
|
||||||
}
|
|
||||||
public Integer getLoginCount() {
|
|
||||||
return loginCount;
|
|
||||||
}
|
|
||||||
public void setLoginCount(Integer loginCount) {
|
|
||||||
this.loginCount = loginCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "MiaoshaUser{" +
|
return "MiaoshaUser{" +
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
package com.geekq.miaosha.domain;
|
package com.geekq.miaosha.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class OrderInfo {
|
public class OrderInfo {
|
||||||
private Long id;
|
private Long id;
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
@ -14,70 +23,4 @@ public class OrderInfo {
|
||||||
private Integer status;
|
private Integer status;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
private Date payDate;
|
private Date payDate;
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public Long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
public void setUserId(Long userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
public Long getGoodsId() {
|
|
||||||
return goodsId;
|
|
||||||
}
|
|
||||||
public void setGoodsId(Long goodsId) {
|
|
||||||
this.goodsId = goodsId;
|
|
||||||
}
|
|
||||||
public Long getDeliveryAddrId() {
|
|
||||||
return deliveryAddrId;
|
|
||||||
}
|
|
||||||
public void setDeliveryAddrId(Long deliveryAddrId) {
|
|
||||||
this.deliveryAddrId = deliveryAddrId;
|
|
||||||
}
|
|
||||||
public String getGoodsName() {
|
|
||||||
return goodsName;
|
|
||||||
}
|
|
||||||
public void setGoodsName(String goodsName) {
|
|
||||||
this.goodsName = goodsName;
|
|
||||||
}
|
|
||||||
public Integer getGoodsCount() {
|
|
||||||
return goodsCount;
|
|
||||||
}
|
|
||||||
public void setGoodsCount(Integer goodsCount) {
|
|
||||||
this.goodsCount = goodsCount;
|
|
||||||
}
|
|
||||||
public Double getGoodsPrice() {
|
|
||||||
return goodsPrice;
|
|
||||||
}
|
|
||||||
public void setGoodsPrice(Double goodsPrice) {
|
|
||||||
this.goodsPrice = goodsPrice;
|
|
||||||
}
|
|
||||||
public Integer getOrderChannel() {
|
|
||||||
return orderChannel;
|
|
||||||
}
|
|
||||||
public void setOrderChannel(Integer orderChannel) {
|
|
||||||
this.orderChannel = orderChannel;
|
|
||||||
}
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
public void setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
public Date getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
public void setCreateDate(Date createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
public Date getPayDate() {
|
|
||||||
return payDate;
|
|
||||||
}
|
|
||||||
public void setPayDate(Date payDate) {
|
|
||||||
this.payDate = payDate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
package com.geekq.miaosha.domain;
|
package com.geekq.miaosha.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class User {
|
public class User {
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
public int getId() {
|
}
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
14
src/main/java/com/geekq/miaosha/mybatis/README.md
Normal file
14
src/main/java/com/geekq/miaosha/mybatis/README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
### 前言 mybatis的一些使用
|
||||||
|
SqlSession 的作用<br>
|
||||||
|
1.像sql中传入语句<br>
|
||||||
|
2.执行SQL语句<br>
|
||||||
|
3.获取执行SQL语句的结果<br>
|
||||||
|
4.事物的控制<br>
|
||||||
|
|
||||||
|
### 如何获得sqlsession?
|
||||||
|
1. 配置文件获取数据库链接相关信息<br>
|
||||||
|
2.通过配置文件来构建sqlsessionfactory<br>
|
||||||
|
3.通过sqlsessionfactory打开数据库会话<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.geekq.miaosha.mybatis.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/message")
|
||||||
|
public class MessageController {
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("index")
|
||||||
|
public String index(){
|
||||||
|
return "message";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,34 +1,20 @@
|
||||||
package com.geekq.miaosha.vo;
|
package com.geekq.miaosha.vo;
|
||||||
|
|
||||||
import com.geekq.miaosha.domain.MiaoshaUser;
|
import com.geekq.miaosha.domain.MiaoshaUser;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class GoodsDetailVo {
|
public class GoodsDetailVo {
|
||||||
private int miaoshaStatus = 0;
|
private int miaoshaStatus = 0;
|
||||||
private int remainSeconds = 0;
|
private int remainSeconds = 0;
|
||||||
private GoodsVo goods ;
|
private GoodsVo goods ;
|
||||||
private MiaoshaUser user;
|
private MiaoshaUser user;
|
||||||
public int getMiaoshaStatus() {
|
|
||||||
return miaoshaStatus;
|
|
||||||
}
|
|
||||||
public void setMiaoshaStatus(int miaoshaStatus) {
|
|
||||||
this.miaoshaStatus = miaoshaStatus;
|
|
||||||
}
|
|
||||||
public int getRemainSeconds() {
|
|
||||||
return remainSeconds;
|
|
||||||
}
|
|
||||||
public void setRemainSeconds(int remainSeconds) {
|
|
||||||
this.remainSeconds = remainSeconds;
|
|
||||||
}
|
|
||||||
public GoodsVo getGoods() {
|
|
||||||
return goods;
|
|
||||||
}
|
|
||||||
public void setGoods(GoodsVo goods) {
|
|
||||||
this.goods = goods;
|
|
||||||
}
|
|
||||||
public MiaoshaUser getUser() {
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
public void setUser(MiaoshaUser user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,17 @@
|
||||||
package com.geekq.miaosha.vo;
|
package com.geekq.miaosha.vo;
|
||||||
|
|
||||||
import com.geekq.miaosha.domain.Goods;
|
import com.geekq.miaosha.domain.Goods;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class GoodsVo extends Goods {
|
public class GoodsVo extends Goods {
|
||||||
private Double miaoshaPrice;
|
private Double miaoshaPrice;
|
||||||
private Integer stockCount;
|
private Integer stockCount;
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
public Integer getStockCount() {
|
|
||||||
return stockCount;
|
|
||||||
}
|
|
||||||
public void setStockCount(Integer stockCount) {
|
|
||||||
this.stockCount = stockCount;
|
|
||||||
}
|
|
||||||
public Date getStartDate() {
|
|
||||||
return startDate;
|
|
||||||
}
|
|
||||||
public void setStartDate(Date startDate) {
|
|
||||||
this.startDate = startDate;
|
|
||||||
}
|
|
||||||
public Date getEndDate() {
|
|
||||||
return endDate;
|
|
||||||
}
|
|
||||||
public void setEndDate(Date endDate) {
|
|
||||||
this.endDate = endDate;
|
|
||||||
}
|
|
||||||
public Double getMiaoshaPrice() {
|
|
||||||
return miaoshaPrice;
|
|
||||||
}
|
|
||||||
public void setMiaoshaPrice(Double miaoshaPrice) {
|
|
||||||
this.miaoshaPrice = miaoshaPrice;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
package com.geekq.miaosha.vo;
|
package com.geekq.miaosha.vo;
|
||||||
|
|
||||||
import com.geekq.miaosha.validator.IsMobile;
|
import com.geekq.miaosha.validator.IsMobile;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class LoginVo {
|
public class LoginVo {
|
||||||
@NotNull
|
@NotNull
|
||||||
@IsMobile
|
@IsMobile
|
||||||
|
@ -14,22 +22,6 @@ public class LoginVo {
|
||||||
@Length(min=32)
|
@Length(min=32)
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LoginVo{" +
|
return "LoginVo{" +
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
package com.geekq.miaosha.vo;
|
package com.geekq.miaosha.vo;
|
||||||
|
|
||||||
import com.geekq.miaosha.domain.OrderInfo;
|
import com.geekq.miaosha.domain.OrderInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class OrderDetailVo {
|
public class OrderDetailVo {
|
||||||
private GoodsVo goods;
|
private GoodsVo goods;
|
||||||
private OrderInfo order;
|
private OrderInfo order;
|
||||||
|
|
71
src/main/resources/application-dev.properties
Normal file
71
src/main/resources/application-dev.properties
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
#thymeleaf
|
||||||
|
spring.thymeleaf.prefix=classpath:/templates/
|
||||||
|
spring.thymeleaf.suffix=.html
|
||||||
|
spring.thymeleaf.cache=false
|
||||||
|
spring.thymeleaf.content-type=text/html
|
||||||
|
spring.thymeleaf.enabled=true
|
||||||
|
spring.thymeleaf.encoding=UTF-8
|
||||||
|
spring.thymeleaf.mode=HTML5
|
||||||
|
|
||||||
|
#mybatis
|
||||||
|
mybatis.type-aliases-package=com.geekq.miaosha.domain
|
||||||
|
#开启驼峰转换
|
||||||
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
#mybatis.mapperLocations = classpath:com/geekq/miaosha/dao/*.xml
|
||||||
|
mybatis.mapperLocations=classpath:mybatis/mapper/*.xml
|
||||||
|
#add mybatis
|
||||||
|
mybatis.config-locations=classpath:mybatis/config.xml
|
||||||
|
#datasource
|
||||||
|
spring.datasource.url=jdbc:mysql://localhost:3306/qiurunze?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
||||||
|
spring.datasource.username=root
|
||||||
|
spring.datasource.password=aixiyue11
|
||||||
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
|
#druid
|
||||||
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
spring.datasource.filters=stat
|
||||||
|
spring.datasource.maxActive=1000
|
||||||
|
spring.datasource.initialSize=100
|
||||||
|
spring.datasource.maxWait=60000
|
||||||
|
spring.datasource.minIdle=500
|
||||||
|
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||||
|
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||||
|
spring.datasource.validationQuery=select 'x'
|
||||||
|
spring.datasource.testWhileIdle=true
|
||||||
|
spring.datasource.testOnBorrow=false
|
||||||
|
spring.datasource.testOnReturn=false
|
||||||
|
spring.datasource.poolPreparedStatements=true
|
||||||
|
spring.datasource.maxOpenPreparedStatements=20
|
||||||
|
#static
|
||||||
|
spring.resources.add-mappings=true
|
||||||
|
spring.resources.cache-period= 3600
|
||||||
|
spring.resources.chain.cache=true
|
||||||
|
spring.resources.chain.enabled=true
|
||||||
|
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.timeout=100
|
||||||
|
redis.password=123456
|
||||||
|
redis.poolMaxTotal=1000
|
||||||
|
redis.poolMaxIdle=500
|
||||||
|
redis.poolMaxWait=500
|
||||||
|
#rabbitmq
|
||||||
|
spring.rabbitmq.host=localhost
|
||||||
|
spring.rabbitmq.port=5672
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
|
spring.rabbitmq.listener.simple.concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.max-concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.prefetch= 1
|
||||||
|
spring.rabbitmq.listener.simple.auto-startup=true
|
||||||
|
spring.rabbitmq.listener.simple.default-requeue-rejected= true
|
||||||
|
spring.rabbitmq.template.retry.enabled=true
|
||||||
|
spring.rabbitmq.template.retry.initial-interval=1000
|
||||||
|
spring.rabbitmq.template.retry.max-attempts=3
|
||||||
|
spring.rabbitmq.template.retry.max-interval=10000
|
||||||
|
spring.rabbitmq.template.retry.multiplier=1.0
|
||||||
|
|
||||||
|
## maven隔离
|
71
src/main/resources/application-prod.properties
Normal file
71
src/main/resources/application-prod.properties
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
#thymeleaf
|
||||||
|
spring.thymeleaf.prefix=classpath:/templates/
|
||||||
|
spring.thymeleaf.suffix=.html
|
||||||
|
spring.thymeleaf.cache=false
|
||||||
|
spring.thymeleaf.content-type=text/html
|
||||||
|
spring.thymeleaf.enabled=true
|
||||||
|
spring.thymeleaf.encoding=UTF-8
|
||||||
|
spring.thymeleaf.mode=HTML5
|
||||||
|
|
||||||
|
#mybatis
|
||||||
|
mybatis.type-aliases-package=com.geekq.miaosha.domain
|
||||||
|
#开启驼峰转换
|
||||||
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
#mybatis.mapperLocations = classpath:com/geekq/miaosha/dao/*.xml
|
||||||
|
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.username=root
|
||||||
|
spring.datasource.password=aixiyue11
|
||||||
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
|
#druid
|
||||||
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
spring.datasource.filters=stat
|
||||||
|
spring.datasource.maxActive=1000
|
||||||
|
spring.datasource.initialSize=100
|
||||||
|
spring.datasource.maxWait=60000
|
||||||
|
spring.datasource.minIdle=500
|
||||||
|
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||||
|
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||||
|
spring.datasource.validationQuery=select 'x'
|
||||||
|
spring.datasource.testWhileIdle=true
|
||||||
|
spring.datasource.testOnBorrow=false
|
||||||
|
spring.datasource.testOnReturn=false
|
||||||
|
spring.datasource.poolPreparedStatements=true
|
||||||
|
spring.datasource.maxOpenPreparedStatements=20
|
||||||
|
#static
|
||||||
|
spring.resources.add-mappings=true
|
||||||
|
spring.resources.cache-period= 3600
|
||||||
|
spring.resources.chain.cache=true
|
||||||
|
spring.resources.chain.enabled=true
|
||||||
|
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.timeout=100
|
||||||
|
redis.password=123456
|
||||||
|
redis.poolMaxTotal=1000
|
||||||
|
redis.poolMaxIdle=500
|
||||||
|
redis.poolMaxWait=500
|
||||||
|
#rabbitmq
|
||||||
|
spring.rabbitmq.host=localhost
|
||||||
|
spring.rabbitmq.port=5672
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
|
spring.rabbitmq.listener.simple.concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.max-concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.prefetch= 1
|
||||||
|
spring.rabbitmq.listener.simple.auto-startup=true
|
||||||
|
spring.rabbitmq.listener.simple.default-requeue-rejected= true
|
||||||
|
spring.rabbitmq.template.retry.enabled=true
|
||||||
|
spring.rabbitmq.template.retry.initial-interval=1000
|
||||||
|
spring.rabbitmq.template.retry.max-attempts=3
|
||||||
|
spring.rabbitmq.template.retry.max-interval=10000
|
||||||
|
spring.rabbitmq.template.retry.multiplier=1.0
|
||||||
|
|
||||||
|
## maven隔离
|
71
src/main/resources/application-test.properties
Normal file
71
src/main/resources/application-test.properties
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
#thymeleaf test
|
||||||
|
spring.thymeleaf.prefix=classpath:/templates/
|
||||||
|
spring.thymeleaf.suffix=.html
|
||||||
|
spring.thymeleaf.cache=false
|
||||||
|
spring.thymeleaf.content-type=text/html
|
||||||
|
spring.thymeleaf.enabled=true
|
||||||
|
spring.thymeleaf.encoding=UTF-8
|
||||||
|
spring.thymeleaf.mode=HTML5
|
||||||
|
|
||||||
|
#mybatis
|
||||||
|
mybatis.type-aliases-package=com.geekq.miaosha.domain
|
||||||
|
#开启驼峰转换
|
||||||
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
#mybatis.mapperLocations = classpath:com/geekq/miaosha/dao/*.xml
|
||||||
|
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.username=root
|
||||||
|
spring.datasource.password=aixiyue11
|
||||||
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
|
#druid
|
||||||
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
spring.datasource.filters=stat
|
||||||
|
spring.datasource.maxActive=1000
|
||||||
|
spring.datasource.initialSize=100
|
||||||
|
spring.datasource.maxWait=60000
|
||||||
|
spring.datasource.minIdle=500
|
||||||
|
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||||
|
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||||
|
spring.datasource.validationQuery=select 'x'
|
||||||
|
spring.datasource.testWhileIdle=true
|
||||||
|
spring.datasource.testOnBorrow=false
|
||||||
|
spring.datasource.testOnReturn=false
|
||||||
|
spring.datasource.poolPreparedStatements=true
|
||||||
|
spring.datasource.maxOpenPreparedStatements=20
|
||||||
|
#static
|
||||||
|
spring.resources.add-mappings=true
|
||||||
|
spring.resources.cache-period= 3600
|
||||||
|
spring.resources.chain.cache=true
|
||||||
|
spring.resources.chain.enabled=true
|
||||||
|
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.timeout=100
|
||||||
|
redis.password=123456
|
||||||
|
redis.poolMaxTotal=1000
|
||||||
|
redis.poolMaxIdle=500
|
||||||
|
redis.poolMaxWait=500
|
||||||
|
#rabbitmq
|
||||||
|
spring.rabbitmq.host=localhost
|
||||||
|
spring.rabbitmq.port=5672
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
|
spring.rabbitmq.listener.simple.concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.max-concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.prefetch= 1
|
||||||
|
spring.rabbitmq.listener.simple.auto-startup=true
|
||||||
|
spring.rabbitmq.listener.simple.default-requeue-rejected= true
|
||||||
|
spring.rabbitmq.template.retry.enabled=true
|
||||||
|
spring.rabbitmq.template.retry.initial-interval=1000
|
||||||
|
spring.rabbitmq.template.retry.max-attempts=3
|
||||||
|
spring.rabbitmq.template.retry.max-interval=10000
|
||||||
|
spring.rabbitmq.template.retry.multiplier=1.0
|
||||||
|
|
||||||
|
## maven隔离
|
|
@ -66,4 +66,7 @@ spring.rabbitmq.template.retry.enabled=true
|
||||||
spring.rabbitmq.template.retry.initial-interval=1000
|
spring.rabbitmq.template.retry.initial-interval=1000
|
||||||
spring.rabbitmq.template.retry.max-attempts=3
|
spring.rabbitmq.template.retry.max-attempts=3
|
||||||
spring.rabbitmq.template.retry.max-interval=10000
|
spring.rabbitmq.template.retry.max-interval=10000
|
||||||
spring.rabbitmq.template.retry.multiplier=1.0
|
spring.rabbitmq.template.retry.multiplier=1.0
|
||||||
|
|
||||||
|
## maven隔离
|
||||||
|
pring.profiles.active=@activatedProperties@
|
72
src/main/resources/config/application-test.properties
Normal file
72
src/main/resources/config/application-test.properties
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#thymeleaf test
|
||||||
|
spring.thymeleaf.prefix=classpath:/templates/
|
||||||
|
spring.thymeleaf.suffix=.html
|
||||||
|
spring.thymeleaf.cache=false
|
||||||
|
spring.thymeleaf.content-type=text/html
|
||||||
|
spring.thymeleaf.enabled=true
|
||||||
|
spring.thymeleaf.encoding=UTF-8
|
||||||
|
spring.thymeleaf.mode=HTML5
|
||||||
|
|
||||||
|
#mybatis
|
||||||
|
mybatis.type-aliases-package=com.geekq.miaosha.domain
|
||||||
|
#开启驼峰转换
|
||||||
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
#mybatis.mapperLocations = classpath:com/geekq/miaosha/dao/*.xml
|
||||||
|
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.username=root
|
||||||
|
spring.datasource.password=aixiyue11
|
||||||
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
|
#druid
|
||||||
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
spring.datasource.filters=stat
|
||||||
|
spring.datasource.maxActive=1000
|
||||||
|
spring.datasource.initialSize=100
|
||||||
|
spring.datasource.maxWait=60000
|
||||||
|
spring.datasource.minIdle=500
|
||||||
|
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||||
|
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||||
|
spring.datasource.validationQuery=select 'x'
|
||||||
|
spring.datasource.testWhileIdle=true
|
||||||
|
spring.datasource.testOnBorrow=false
|
||||||
|
spring.datasource.testOnReturn=false
|
||||||
|
spring.datasource.poolPreparedStatements=true
|
||||||
|
spring.datasource.maxOpenPreparedStatements=20
|
||||||
|
#static
|
||||||
|
spring.resources.add-mappings=true
|
||||||
|
spring.resources.cache-period= 3600
|
||||||
|
spring.resources.chain.cache=true
|
||||||
|
spring.resources.chain.enabled=true
|
||||||
|
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.timeout=100
|
||||||
|
redis.password=123456
|
||||||
|
redis.poolMaxTotal=1000
|
||||||
|
redis.poolMaxIdle=500
|
||||||
|
redis.poolMaxWait=500
|
||||||
|
#rabbitmq
|
||||||
|
spring.rabbitmq.host=localhost
|
||||||
|
spring.rabbitmq.port=5672
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
|
spring.rabbitmq.listener.simple.concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.max-concurrency= 10
|
||||||
|
spring.rabbitmq.listener.simple.prefetch= 1
|
||||||
|
spring.rabbitmq.listener.simple.auto-startup=true
|
||||||
|
spring.rabbitmq.listener.simple.default-requeue-rejected= true
|
||||||
|
spring.rabbitmq.template.retry.enabled=true
|
||||||
|
spring.rabbitmq.template.retry.initial-interval=1000
|
||||||
|
spring.rabbitmq.template.retry.max-attempts=3
|
||||||
|
spring.rabbitmq.template.retry.max-interval=10000
|
||||||
|
spring.rabbitmq.template.retry.multiplier=1.0
|
||||||
|
|
||||||
|
## maven隔离
|
||||||
|
pring.profiles.active=@activatedProperties@
|
26
src/main/resources/dubbo/dubbo_consumer.xml
Normal file
26
src/main/resources/dubbo/dubbo_consumer.xml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||||
|
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
|
||||||
|
http://code.alibabatech.com/schema/dubbo
|
||||||
|
|
||||||
|
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
|
||||||
|
|
||||||
|
<!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
|
||||||
|
|
||||||
|
<dubbo:application name="dubbo_consumer" />
|
||||||
|
|
||||||
|
<!-- 使用multicast广播注册中心暴露发现服务地址 -->
|
||||||
|
|
||||||
|
<dubbo:registry protocol="zookeeper" address="zookeeper://192.168.1.116:2181" />
|
||||||
|
|
||||||
|
<!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
|
||||||
|
|
||||||
|
<dubbo:reference id="demoService" interface="com.geekq.miaosha.api.DemoService" />
|
||||||
|
|
||||||
|
</beans>
|
32
src/main/resources/dubbo/springmvc.xml
Normal file
32
src/main/resources/dubbo/springmvc.xml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
|
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
|
||||||
|
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/aop
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/beans
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/util
|
||||||
|
|
||||||
|
http://www.springframework.org/schema/util/spring-util-4.0.xsd"
|
||||||
|
|
||||||
|
default-autowire="byName">
|
||||||
|
|
||||||
|
<aop:aspectj-autoproxy />
|
||||||
|
|
||||||
|
<context:component-scan base-package="com.geekq.miaosha" />
|
||||||
|
|
||||||
|
<import resource="classpath:/dubbo_consumer.xml" />
|
||||||
|
|
||||||
|
</beans>
|
|
@ -66,4 +66,7 @@ spring.rabbitmq.template.retry.enabled=true
|
||||||
spring.rabbitmq.template.retry.initial-interval=1000
|
spring.rabbitmq.template.retry.initial-interval=1000
|
||||||
spring.rabbitmq.template.retry.max-attempts=3
|
spring.rabbitmq.template.retry.max-attempts=3
|
||||||
spring.rabbitmq.template.retry.max-interval=10000
|
spring.rabbitmq.template.retry.max-interval=10000
|
||||||
spring.rabbitmq.template.retry.multiplier=1.0
|
spring.rabbitmq.template.retry.multiplier=1.0
|
||||||
|
|
||||||
|
## maven隔离
|
||||||
|
pring.profiles.active=test
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user