Skip to content

Commit

Permalink
修改雪花算法配置
Browse files Browse the repository at this point in the history
  • Loading branch information
eelve committed Apr 3, 2020
1 parent 114ff88 commit 39e62c3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<!-- kaptcha验证码的依赖 -->
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>2.3.2</version>
</dependency>
<!--使用MultipartHttpServletRequest上传文件所依赖的jar包 -->
<dependency>
<groupId>commons-fileupload</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.eelve.lovinstarter.model.SnowflakeIdWorker;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
Expand All @@ -13,9 +14,12 @@
* @Date 2020/4/3 14:17
* @Version 1.0
**/
@Log

@Component
@Log
public class SnowflakeComponent {


@Value("${server.datacenterId}")
private long datacenterId;

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ spring:
trigger-file: trigger.txt
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.eelve.springbootredis.model
type-aliases-package: com.eelve.lovinstarter.model

#pagehelper
pagehelper:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>

<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<root level="INFO">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package com.eelve.lovinstarter;

import com.eelve.lovinstarter.utils.SnowflakeUtil;
import lombok.extern.java.Log;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
@Log
public class LovinstarterApplicationTests {


@Test
public void contextLoads() {
System.out.println(SnowflakeUtil.nextId());
log.info("----------------------");
log.info(SnowflakeUtil.nextId()+"");
}

}

0 comments on commit 39e62c3

Please sign in to comment.