first commit.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package xyz.zhouxy.plusone;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@SpringBootApplication
|
||||
@Slf4j
|
||||
public class PlusoneApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.debug("Plusone started!");
|
||||
SpringApplication.run(PlusoneApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "plusone.application.name",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.application.name'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.server.port",
|
||||
"type": "java.lang.Integer",
|
||||
"description": "A description for 'plusone.server.port'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.debug",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "A description for 'plusone.debug'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.mail.host",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.mail.host'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.mail.password",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.mail.password'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.exception.handle-all-exception",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "A description for 'plusone.exception.handle-all-exception'"
|
||||
}
|
||||
]
|
||||
}
|
79
plusone-start/src/main/resources/application.yaml
Normal file
79
plusone-start/src/main/resources/application.yaml
Normal file
@@ -0,0 +1,79 @@
|
||||
plusone:
|
||||
application:
|
||||
name: plusone
|
||||
server:
|
||||
port: 8108
|
||||
debug: true
|
||||
|
||||
# 短信发送相关参数
|
||||
sms:
|
||||
region: ap-guangzhou
|
||||
credential:
|
||||
secret-id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
secret-key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
client:
|
||||
# SDK 默认用 TC3-HMAC-SHA256 进行签名,非必要请不要修改这个字段
|
||||
sign-method: HmacSHA256
|
||||
http:
|
||||
# proxy:
|
||||
# host: xxx
|
||||
# port: xxx
|
||||
req-method: POST
|
||||
conn-timeout: 60
|
||||
app-id: 1111111111
|
||||
templates:
|
||||
code: 0000000
|
||||
|
||||
# 邮件发送相关参数
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
#设置邮件发送者
|
||||
from: example@163.com
|
||||
password: XXXXXXXXXXXXXXXX
|
||||
subject:
|
||||
code: Plusone
|
||||
template:
|
||||
code: 【Plusone】验证码:%s,10分钟内有效,请勿泄露。
|
||||
|
||||
# 异常拦截机制是否拦截所有异常
|
||||
exception:
|
||||
handle-all-exception: false
|
||||
|
||||
spring:
|
||||
# redis配置
|
||||
redis:
|
||||
# Redis数据库索引(默认为0)
|
||||
database: 1
|
||||
# Redis服务器地址
|
||||
host: 127.0.0.1
|
||||
# Redis服务器连接端口
|
||||
port: 6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
# password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数
|
||||
max-active: 200
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 10
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 数据库
|
||||
datasource:
|
||||
url: jdbc:postgresql://localhost:5432/plusone
|
||||
username: plusone
|
||||
password: XXXXXXXXXXXXXXXX
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
file:
|
||||
name: ${user.home}/logs/${plusone.application.name}.log
|
||||
level:
|
||||
root: INFO
|
||||
xyz.zhouxy.plusone: DEBUG
|
||||
org.springframework.jdbc.core: DEBUG
|
||||
xyz.zhouxy.plusone.system.application.query: DEBUG
|
32
plusone-start/src/main/resources/logback.xml
Normal file
32
plusone-start/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%green(%d{yyyy-MM-dd HH:mm:ss.SSS}) %highlight(%5level) ${PID:- } - [%15.15t] %cyan(%-40.108logger) : %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %5level ${PID:- } - [%15.15t] %-50.50logger : %msg%n</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
<file>log/output.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>log/output.log.%i</fileNamePattern>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<MaxFileSize>20MB</MaxFileSize>
|
||||
</triggeringPolicy>
|
||||
</appender> -->
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<!-- <appender-ref ref="FILE" /> -->
|
||||
</root>
|
||||
|
||||
</configuration>
|
@@ -0,0 +1,22 @@
|
||||
package xyz.zhouxy.plusone;
|
||||
|
||||
import java.io.ObjectStreamClass;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import xyz.zhouxy.plusone.exception.PlusoneException;
|
||||
|
||||
@Slf4j
|
||||
class SerialTests {
|
||||
|
||||
@Test
|
||||
void testSerialVersionUID() {
|
||||
var cl = PlusoneException.class;
|
||||
var c = ObjectStreamClass.lookup(cl);
|
||||
var uid = c.getSerialVersionUID();
|
||||
log.info("\n @java.io.Serial" +
|
||||
"\n private static final long serialVersionUID = {}L;", uid);
|
||||
}
|
||||
|
||||
}
|
31
plusone-start/src/test/java/xyz/zhouxy/plusone/TestAop.java
Normal file
31
plusone-start/src/test/java/xyz/zhouxy/plusone/TestAop.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package xyz.zhouxy.plusone;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import xyz.zhouxy.plusone.system.application.query.result.LoginInfoViewObject;
|
||||
import xyz.zhouxy.plusone.system.application.service.AdminLoginService;
|
||||
import xyz.zhouxy.plusone.system.application.service.command.LoginByPasswordCommand;
|
||||
import xyz.zhouxy.plusone.system.domain.model.account.AccountRepository;
|
||||
|
||||
@SpringBootTest(classes = PlusoneApplication.class)
|
||||
class TestAop {
|
||||
|
||||
@Resource
|
||||
AccountRepository repository;
|
||||
|
||||
@Resource
|
||||
AdminLoginService service;
|
||||
|
||||
@Test
|
||||
void testAop() {
|
||||
LoginByPasswordCommand command = new LoginByPasswordCommand();
|
||||
command.setPrincipal("Code108");
|
||||
command.setPassword("2333");
|
||||
command.setRememberMe(false);
|
||||
LoginInfoViewObject loginInfo = service.loginByPassword(command);
|
||||
System.err.println(loginInfo);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user