!7 换了几个较小的包。缩了下 server 大小
Merge pull request !7 from 西东/feature/1.6.5-solon
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.noear</groupId>
|
<groupId>org.noear</groupId>
|
||||||
<artifactId>solon-parent</artifactId>
|
<artifactId>solon-parent</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.2.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>fun.asgc</groupId>
|
<groupId>fun.asgc</groupId>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.noear</groupId>
|
<groupId>org.noear</groupId>
|
||||||
<artifactId>solon-parent</artifactId>
|
<artifactId>solon-parent</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.2.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>fun.asgc</groupId>
|
<groupId>fun.asgc</groupId>
|
||||||
|
|||||||
@@ -26,21 +26,18 @@
|
|||||||
<artifactId>snakeyaml</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>HikariCP</artifactId>
|
||||||
<version>1.1.24</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>8.0.29</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.7.2</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package fun.asgc.neutrino.core.db.dao;
|
package fun.asgc.neutrino.core.db.dao;
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import fun.asgc.neutrino.core.db.annotation.Column;
|
import fun.asgc.neutrino.core.db.annotation.Column;
|
||||||
import fun.asgc.neutrino.core.db.annotation.Id;
|
import fun.asgc.neutrino.core.db.annotation.Id;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -29,6 +29,7 @@ import lombok.ToString;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import javax.activation.DataSource;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,12 +40,12 @@ import java.util.List;
|
|||||||
* @date: 2022/6/28
|
* @date: 2022/6/28
|
||||||
*/
|
*/
|
||||||
public class DaoTest {
|
public class DaoTest {
|
||||||
private DruidDataSource dataSource;
|
private HikariDataSource dataSource;
|
||||||
private DBType dbType;
|
private DBType dbType;
|
||||||
|
|
||||||
{
|
{
|
||||||
dataSource = new DruidDataSource();
|
dataSource = new HikariDataSource();
|
||||||
dataSource.setUrl("jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8");
|
dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8");
|
||||||
dataSource.setUsername("root");
|
dataSource.setUsername("root");
|
||||||
dataSource.setPassword("YWasgc@10520");
|
dataSource.setPassword("YWasgc@10520");
|
||||||
dbType = DBType.MYSQL;
|
dbType = DBType.MYSQL;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package fun.asgc.neutrino.core.db.mapper;
|
package fun.asgc.neutrino.core.db.mapper;
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import fun.asgc.neutrino.core.annotation.Bean;
|
import fun.asgc.neutrino.core.annotation.Bean;
|
||||||
import fun.asgc.neutrino.core.annotation.Component;
|
import fun.asgc.neutrino.core.annotation.Component;
|
||||||
import fun.asgc.neutrino.core.annotation.Order;
|
import fun.asgc.neutrino.core.annotation.Order;
|
||||||
@@ -38,8 +38,8 @@ public class Configuration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JdbcTemplate jdbcTemplate() {
|
public JdbcTemplate jdbcTemplate() {
|
||||||
DruidDataSource dataSource = new DruidDataSource();
|
HikariDataSource dataSource = new HikariDataSource();
|
||||||
dataSource.setUrl("jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8");
|
dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8");
|
||||||
dataSource.setUsername("root");
|
dataSource.setUsername("root");
|
||||||
dataSource.setPassword("YWasgc@10520");
|
dataSource.setPassword("YWasgc@10520");
|
||||||
return new JdbcTemplate(dataSource);
|
return new JdbcTemplate(dataSource);
|
||||||
|
|||||||
+3
-3
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package fun.asgc.neutrino.core.db.template;
|
package fun.asgc.neutrino.core.db.template;
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import fun.asgc.neutrino.core.db.annotation.Id;
|
import fun.asgc.neutrino.core.db.annotation.Id;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@@ -42,8 +42,8 @@ public class JdbcTemplateTestForMySql {
|
|||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
{
|
{
|
||||||
DruidDataSource dataSource = new DruidDataSource();
|
HikariDataSource dataSource = new HikariDataSource();
|
||||||
dataSource.setUrl("jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8");
|
dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8");
|
||||||
dataSource.setUsername("root");
|
dataSource.setUsername("root");
|
||||||
dataSource.setPassword("YWasgc@10520");
|
dataSource.setPassword("YWasgc@10520");
|
||||||
jdbcTemplate = new JdbcTemplate(dataSource);
|
jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
|
|||||||
+3
-4
@@ -21,8 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package fun.asgc.neutrino.core.db.template;
|
package fun.asgc.neutrino.core.db.template;
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import fun.asgc.neutrino.core.db.annotation.Id;
|
import fun.asgc.neutrino.core.db.annotation.Id;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@@ -41,9 +40,9 @@ public class JdbcTemplateTestForSqlite {
|
|||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
{
|
{
|
||||||
DruidDataSource dataSource = new DruidDataSource();
|
HikariDataSource dataSource = new HikariDataSource();
|
||||||
// dataSource.setUrl("jdbc:sqlite:" + JdbcTemplateTestForSqlite.class.getResource("/sqlite.db").getPath());
|
// dataSource.setUrl("jdbc:sqlite:" + JdbcTemplateTestForSqlite.class.getResource("/sqlite.db").getPath());
|
||||||
dataSource.setUrl("jdbc:sqlite:../data.db");
|
dataSource.setJdbcUrl("jdbc:sqlite:../data.db");
|
||||||
dataSource.setDriverClassName("org.sqlite.JDBC");
|
dataSource.setDriverClassName("org.sqlite.JDBC");
|
||||||
jdbcTemplate = new JdbcTemplate(dataSource);
|
jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.noear</groupId>
|
<groupId>org.noear</groupId>
|
||||||
<artifactId>solon-lib</artifactId>
|
<artifactId>solon-lib</artifactId>
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-core</artifactId>
|
<artifactId>hutool-core</artifactId>
|
||||||
<version>5.8.15</version>
|
<version>${hutool.ver}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>fun.asgc.neutrino</groupId>-->
|
<!-- <groupId>fun.asgc.neutrino</groupId>-->
|
||||||
|
|||||||
@@ -13,27 +13,22 @@
|
|||||||
|
|
||||||
<artifactId>neutrino-proxy-server</artifactId>
|
<artifactId>neutrino-proxy-server</artifactId>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.noear</groupId>
|
<groupId>org.noear</groupId>
|
||||||
<artifactId>solon-api</artifactId>
|
<artifactId>solon-api</artifactId>
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.noear</groupId>
|
<groupId>org.noear</groupId>
|
||||||
<artifactId>mybatis-plus-solon-plugin</artifactId>
|
<artifactId>mybatis-plus-solon-plugin</artifactId>
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.noear</groupId>
|
<groupId>org.noear</groupId>
|
||||||
<artifactId>mybatis-pagehelper-solon-plugin</artifactId>
|
<artifactId>mybatis-pagehelper-solon-plugin</artifactId>
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.noear</groupId>
|
<groupId>org.noear</groupId>
|
||||||
<artifactId>activerecord-solon-plugin</artifactId>
|
<artifactId>activerecord-solon-plugin</artifactId>
|
||||||
<version>2.2.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--orika orika-solon-plugin用户,server端没直接用,为何这里需要引入?-->
|
<!--orika orika-solon-plugin用户,server端没直接用,为何这里需要引入?-->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -44,7 +39,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>fun.asgc</groupId>
|
<groupId>fun.asgc</groupId>
|
||||||
<artifactId>orika-solon-plugin</artifactId>
|
<artifactId>orika-solon-plugin</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.2.2</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/../_solon_plugin/orika-solon-plugin/pom.xml</systemPath>
|
<systemPath>${project.basedir}/../_solon_plugin/orika-solon-plugin/pom.xml</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -52,7 +47,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>fun.asgc</groupId>
|
<groupId>fun.asgc</groupId>
|
||||||
<artifactId>job-solon-plugin</artifactId>
|
<artifactId>job-solon-plugin</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.2.2</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/../_solon_plugin/job-solon-plugin/pom.xml</systemPath>
|
<systemPath>${project.basedir}/../_solon_plugin/job-solon-plugin/pom.xml</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -69,17 +64,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.39.2.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid</artifactId>
|
|
||||||
<version>1.1.24</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>8.0.29</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zaxxer</groupId>
|
||||||
|
<artifactId>HikariCP</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package fun.asgc.neutrino.proxy.server;
|
|||||||
import fun.asgc.solon.extend.job.annotation.EnableJob;
|
import fun.asgc.solon.extend.job.annotation.EnableJob;
|
||||||
import org.noear.solon.Solon;
|
import org.noear.solon.Solon;
|
||||||
import org.noear.solon.annotation.Controller;
|
import org.noear.solon.annotation.Controller;
|
||||||
|
import org.noear.solon.annotation.SolonMain;
|
||||||
import org.noear.solon.web.cors.CrossFilter;
|
import org.noear.solon.web.cors.CrossFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +12,7 @@ import org.noear.solon.web.cors.CrossFilter;
|
|||||||
* @date: 2022/6/16
|
* @date: 2022/6/16
|
||||||
*/
|
*/
|
||||||
@EnableJob
|
@EnableJob
|
||||||
@Controller
|
@SolonMain
|
||||||
public class ProxyServer {
|
public class ProxyServer {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
+2
@@ -48,6 +48,7 @@ public class DBInitialize implements EventListener<AppLoadEndEvent> {
|
|||||||
private static List<String> initDataTableNameList = Lists.newArrayList("user", "license", "port_pool", "port_mapping", "job_info");
|
private static List<String> initDataTableNameList = Lists.newArrayList("user", "license", "port_pool", "port_mapping", "job_info");
|
||||||
@Inject
|
@Inject
|
||||||
private DbConfig dbConfig;
|
private DbConfig dbConfig;
|
||||||
|
|
||||||
private DbTypeEnum dbTypeEnum;
|
private DbTypeEnum dbTypeEnum;
|
||||||
|
|
||||||
@Init
|
@Init
|
||||||
@@ -91,6 +92,7 @@ public class DBInitialize implements EventListener<AppLoadEndEvent> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化数据
|
* 初始化数据
|
||||||
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void initDBData() throws Exception {
|
private void initDBData() throws Exception {
|
||||||
|
|||||||
+11
-8
@@ -1,10 +1,10 @@
|
|||||||
package fun.asgc.neutrino.proxy.server.base.db;
|
package fun.asgc.neutrino.proxy.server.base.db;
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||||
import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;
|
import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;
|
||||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import fun.asgc.neutrino.proxy.server.constant.DbTypeEnum;
|
import fun.asgc.neutrino.proxy.server.constant.DbTypeEnum;
|
||||||
import org.apache.ibatis.solon.annotation.Db;
|
import org.apache.ibatis.solon.annotation.Db;
|
||||||
import org.noear.solon.annotation.Bean;
|
import org.noear.solon.annotation.Bean;
|
||||||
@@ -31,14 +31,17 @@ public class DbConfiguration {
|
|||||||
dataSource.setJournalMode(SQLiteConfig.JournalMode.WAL.getValue());
|
dataSource.setJournalMode(SQLiteConfig.JournalMode.WAL.getValue());
|
||||||
return dataSource;
|
return dataSource;
|
||||||
} else if (DbTypeEnum.MYSQL == dbTypeEnum) {
|
} else if (DbTypeEnum.MYSQL == dbTypeEnum) {
|
||||||
DruidDataSource dataSource = new DruidDataSource();
|
HikariDataSource dataSource = new HikariDataSource();
|
||||||
dataSource.setDriverClassName(dbConfig.getDriverClass());
|
dataSource.setDriverClassName(dbConfig.getDriverClass());
|
||||||
dataSource.setUrl(dbConfig.getUrl());
|
dataSource.setJdbcUrl(dbConfig.getUrl());
|
||||||
dataSource.setInitialSize(5);
|
dataSource.setMinimumIdle(5);
|
||||||
dataSource.setMinIdle(5);
|
dataSource.setMaximumPoolSize(20);
|
||||||
dataSource.setMaxActive(20);
|
dataSource.setMaxLifetime(60000);
|
||||||
dataSource.setMaxWait(60000);
|
// dataSource.setInitialSize(5);
|
||||||
dataSource.setPoolPreparedStatements(true);
|
// dataSource.setMinIdle(5);
|
||||||
|
// dataSource.setMaxActive(20);
|
||||||
|
// dataSource.setMaxWait(60000);
|
||||||
|
// dataSource.setPoolPreparedStatements(true);
|
||||||
dataSource.setUsername(dbConfig.getUsername());
|
dataSource.setUsername(dbConfig.getUsername());
|
||||||
dataSource.setPassword(dbConfig.getPassword());
|
dataSource.setPassword(dbConfig.getPassword());
|
||||||
return dataSource;
|
return dataSource;
|
||||||
|
|||||||
+15
-10
@@ -11,6 +11,7 @@ import org.noear.solon.annotation.Bean;
|
|||||||
import org.noear.solon.annotation.Configuration;
|
import org.noear.solon.annotation.Configuration;
|
||||||
import org.noear.solon.annotation.Inject;
|
import org.noear.solon.annotation.Inject;
|
||||||
import org.noear.solon.core.AopContext;
|
import org.noear.solon.core.AopContext;
|
||||||
|
import org.noear.solon.core.bean.LifecycleBean;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,16 +21,19 @@ import java.util.List;
|
|||||||
* @date: 2022/10/8
|
* @date: 2022/10/8
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ProxyConfiguration {
|
public class ProxyConfiguration implements LifecycleBean {
|
||||||
@Bean
|
@Inject
|
||||||
public void dispatcher(@Inject AopContext aopContext) {
|
AopContext aopContext;
|
||||||
aopContext.lifecycle(() -> {
|
|
||||||
List<ProxyMessageHandler> list = aopContext.getBeansOfType(ProxyMessageHandler.class);
|
@Override
|
||||||
Dispatcher<ChannelHandlerContext, ProxyMessage> dispatcher = new DefaultDispatcher<>("消息调度器", list,
|
public void start() throws Throwable {
|
||||||
proxyMessage -> ProxyDataTypeEnum.of((int)proxyMessage.getType()) == null ?
|
List<ProxyMessageHandler> list = aopContext.getBeansOfType(ProxyMessageHandler.class);
|
||||||
null : ProxyDataTypeEnum.of((int)proxyMessage.getType()).getName());
|
|
||||||
aopContext.wrapAndPut(Dispatcher.class, dispatcher);
|
Dispatcher<ChannelHandlerContext, ProxyMessage> dispatcher = new DefaultDispatcher<>("消息调度器", list,
|
||||||
});
|
proxyMessage -> ProxyDataTypeEnum.of((int)proxyMessage.getType()) == null ?
|
||||||
|
null : ProxyDataTypeEnum.of((int)proxyMessage.getType()).getName());
|
||||||
|
|
||||||
|
aopContext.wrapAndPut(Dispatcher.class, dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean("serverBossGroup")
|
@Bean("serverBossGroup")
|
||||||
@@ -41,4 +45,5 @@ public class ProxyConfiguration {
|
|||||||
public NioEventLoopGroup serverWorkerGroup() {
|
public NioEventLoopGroup serverWorkerGroup() {
|
||||||
return new NioEventLoopGroup();
|
return new NioEventLoopGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -74,17 +74,20 @@ public class BaseAuthInterceptor implements RouterInterceptor {
|
|||||||
|
|
||||||
if (result instanceof Throwable) {
|
if (result instanceof Throwable) {
|
||||||
log.error("全局异常", (Throwable) result);
|
log.error("全局异常", (Throwable) result);
|
||||||
|
|
||||||
if (result instanceof ServiceException) {
|
if (result instanceof ServiceException) {
|
||||||
ServiceException exception = (ServiceException) result;
|
ServiceException exception = (ServiceException) result;
|
||||||
return new ResponseBody<>()
|
return new ResponseBody<>()
|
||||||
.setCode(exception.getCode())
|
.setCode(exception.getCode())
|
||||||
.setMsg(exception.getMsg());
|
.setMsg(exception.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseBody<>()
|
return new ResponseBody<>()
|
||||||
.setCode(ExceptionConstant.SYSTEM_ERROR.getCode())
|
.setCode(ExceptionConstant.SYSTEM_ERROR.getCode())
|
||||||
.setMsg(ExceptionConstant.SYSTEM_ERROR.getMsg())
|
.setMsg(ExceptionConstant.SYSTEM_ERROR.getMsg())
|
||||||
.setStack(ExceptionUtils.getStackTrace((Throwable) result));
|
.setStack(ExceptionUtils.getStackTrace((Throwable) result));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseBody<>()
|
return new ResponseBody<>()
|
||||||
.setCode(0)
|
.setCode(0)
|
||||||
.setData(result);
|
.setData(result);
|
||||||
|
|||||||
+3
-1
@@ -24,13 +24,15 @@ public class GlobalExceptionFilter implements Filter {
|
|||||||
chain.doFilter(ctx);
|
chain.doFilter(ctx);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.error("全局异常", e);
|
log.error("全局异常", e);
|
||||||
|
|
||||||
if (e instanceof ServiceException) {
|
if (e instanceof ServiceException) {
|
||||||
ServiceException serviceException = (ServiceException)e;
|
ServiceException serviceException = (ServiceException) e;
|
||||||
ctx.render(new ResponseBody<>()
|
ctx.render(new ResponseBody<>()
|
||||||
.setCode(serviceException.getCode())
|
.setCode(serviceException.getCode())
|
||||||
.setMsg(serviceException.getMsg()));
|
.setMsg(serviceException.getMsg()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.render(new ResponseBody<>()
|
ctx.render(new ResponseBody<>()
|
||||||
.setCode(ExceptionConstant.SYSTEM_ERROR.getCode())
|
.setCode(ExceptionConstant.SYSTEM_ERROR.getCode())
|
||||||
.setMsg(ExceptionConstant.SYSTEM_ERROR.getMsg())
|
.setMsg(ExceptionConstant.SYSTEM_ERROR.getMsg())
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.noear</groupId>
|
||||||
|
<artifactId>solon-parent</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
<relativePath />
|
||||||
|
</parent>
|
||||||
|
|
||||||
<groupId>fun.asgc.neutrino</groupId>
|
<groupId>fun.asgc.neutrino</groupId>
|
||||||
<artifactId>neutrino-proxy</artifactId>
|
<artifactId>neutrino-proxy</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
@@ -50,12 +57,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.0</version>
|
<version>1.18.24</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
<artifactId>snakeyaml</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
<version>1.25</version>
|
<version>1.33</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
@@ -83,6 +90,21 @@
|
|||||||
<artifactId>commons-fileupload</artifactId>
|
<artifactId>commons-fileupload</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.xerial</groupId>
|
||||||
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
|
<version>3.39.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>5.1.49</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zaxxer</groupId>
|
||||||
|
<artifactId>HikariCP</artifactId>
|
||||||
|
<version>4.0.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user