From ad4bd7afd91af0df0f33984153ac64dd7e25809c Mon Sep 17 00:00:00 2001 From: Lambert Rao <101875596+Lambert-Rao@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:48:45 +0800 Subject: [PATCH] [ISSUE #20] Add dependency of console module (#19) * refactor: add dependency of console module and move controllers into console module. * fix: add logback config, fix application-dev.yml and move `` to root `pom.xml` as pointed out in PR#19. --- eventmesh-dashboard-common/pom.xml | 16 ++++- eventmesh-dashboard-console/pom.xml | 61 +++++++++++++++++-- .../console/EventmeshConsoleApplication.java | 38 ++++++++++++ .../eventmesh/dashboard/console/Main.java | 7 --- .../src/main/resources/application-dev.yml | 51 ++++++++++++++++ .../src/main/resources/application.yml | 38 ++++++++++++ .../src/main/resources/logback.xml | 50 +++++++++++++++ eventmesh-dashboard-core/pom.xml | 22 ++----- .../src/main/resources/application-dev.yml | 2 +- pom.xml | 18 ++++++ 10 files changed, 272 insertions(+), 31 deletions(-) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventmeshConsoleApplication.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/Main.java create mode 100644 eventmesh-dashboard-console/src/main/resources/application-dev.yml create mode 100644 eventmesh-dashboard-console/src/main/resources/application.yml create mode 100644 eventmesh-dashboard-console/src/main/resources/logback.xml diff --git a/eventmesh-dashboard-common/pom.xml b/eventmesh-dashboard-common/pom.xml index 4247216f..f79bd00c 100644 --- a/eventmesh-dashboard-common/pom.xml +++ b/eventmesh-dashboard-common/pom.xml @@ -13,9 +13,21 @@ eventmesh-dashboard-common - 8 - 8 + 1.8 UTF-8 + UTF-8 + 2.7.6 + + + junit + junit + + + org.projectlombok + lombok + + + \ No newline at end of file diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml index 2042c89c..fa06c450 100644 --- a/eventmesh-dashboard-console/pom.xml +++ b/eventmesh-dashboard-console/pom.xml @@ -1,7 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.eventmesh.dashboard @@ -13,9 +13,62 @@ eventmesh-dashboard-console - 8 - 8 + 1.8 UTF-8 + UTF-8 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springdoc + springdoc-openapi-ui + 1.7.0 + + + org.springdoc + springdoc-openapi-javadoc + 1.7.0 + + + + + org.apache.eventmesh.dashboard.common + eventmesh-dashboard-common + 0.0.1-SNAPSHOT + + + org.apache.eventmesh.dashboard.service + eventmesh-dashboard-service + 0.0.1-SNAPSHOT + + + + + com.alibaba + druid-spring-boot-starter + 1.2.21 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + com.mysql + mysql-connector-j + runtime + + + \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventmeshConsoleApplication.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventmeshConsoleApplication.java new file mode 100644 index 00000000..1e4d6dba --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventmeshConsoleApplication.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.eventmesh.dashboard.console; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@Slf4j +@SpringBootApplication +@ComponentScan({"org.apache.eventmesh.dashboard.service", "org.apache.eventmesh.dashboard.console"}) +public class EventmeshConsoleApplication { + + public static void main(String[] args) { + try { + SpringApplication.run(EventmeshConsoleApplication.class, args); + log.info("{} Successfully booted.", EventmeshConsoleApplication.class.getSimpleName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/Main.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/Main.java deleted file mode 100644 index 7e966a20..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/Main.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.apache.eventmesh.dashboard.console; - -public class Main { - public static void main(String[] args) { - System.out.println("Hello world!"); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/resources/application-dev.yml b/eventmesh-dashboard-console/src/main/resources/application-dev.yml new file mode 100644 index 00000000..bfe02806 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/resources/application-dev.yml @@ -0,0 +1,51 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +server: + port: 9898 + servlet: + context-path: "/eventmesh" + +spring: + servlet: + multipart: + max-file-size: 500MB + max-request-size: 500MB + application: + name: eventmesh-console + datasource: + name: eventmesh-console + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/eventmesh-dashboard?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true + username: root + password: root + + initial-size: 1 + max-active: 50 + min-idle: 5 + max-wait: 6000 + validation-query: select 'x' + validation-query-timeout: 15 + test-on-borrow: false + test-while-idle: true + min-evictable-idle-time-millis: 300000 + + + + diff --git a/eventmesh-dashboard-console/src/main/resources/application.yml b/eventmesh-dashboard-console/src/main/resources/application.yml new file mode 100644 index 00000000..f39890e9 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/resources/application.yml @@ -0,0 +1,38 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: eventmesh-dashboard + profiles: + active: dev + +logging: + config: classpath:logback.xml + +mybatis: + checkConfig-location: false + configuration: + useGeneratedKeys: true + mapUnderscoreToCamelCase: true + + +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/resources/logback.xml b/eventmesh-dashboard-console/src/main/resources/logback.xml new file mode 100644 index 00000000..c9925d33 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/resources/logback.xml @@ -0,0 +1,50 @@ + + + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n + + + + + ${user.home}/logs/eventmesh-dashboard.log + true + + ${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log + + + 104857600 + + 10 + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n + UTF-8 + + + + + + + + + \ No newline at end of file diff --git a/eventmesh-dashboard-core/pom.xml b/eventmesh-dashboard-core/pom.xml index 98ade695..651cad83 100644 --- a/eventmesh-dashboard-core/pom.xml +++ b/eventmesh-dashboard-core/pom.xml @@ -57,11 +57,6 @@ spring-boot-configuration-processor true - - org.projectlombok - lombok - true - org.springframework.boot spring-boot-starter-test @@ -69,6 +64,11 @@ + + org.apache.eventmesh.dashboard.common + eventmesh-dashboard-common + 0.0.1-SNAPSHOT + org.apache.commons commons-lang3 @@ -80,18 +80,6 @@ 2.0.40 - - - org.springdoc - springdoc-openapi-ui - 1.7.0 - - - org.springdoc - springdoc-openapi-javadoc - 1.7.0 - - org.mockito diff --git a/eventmesh-dashboard-core/src/main/resources/application-dev.yml b/eventmesh-dashboard-core/src/main/resources/application-dev.yml index 91377864..f61a3c39 100644 --- a/eventmesh-dashboard-core/src/main/resources/application-dev.yml +++ b/eventmesh-dashboard-core/src/main/resources/application-dev.yml @@ -21,7 +21,7 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/eventmesh-dashboard?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 username: root - password: + password: root initial-size: 1 max-active: 50 diff --git a/pom.xml b/pom.xml index 3abf4205..ed8fd4fb 100644 --- a/pom.xml +++ b/pom.xml @@ -78,6 +78,8 @@ 8 8 UTF-8 + 2.7.6 + 2.3.2 @@ -87,4 +89,20 @@ eventmesh-dashboard-service eventmesh-dashboard-common + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis-spring-boot.version} + + + \ No newline at end of file