Commit d608c4b9844af070a2e45be6b6f20f5c5e4e3660
1 parent
3647fd36
【功能实现】IoT:增加 HttpPlugin 独立启动的 demo
Showing
5 changed files
with
39 additions
and
6 deletions
yudao-dependencies/pom.xml
| ... | ... | @@ -67,7 +67,7 @@ |
| 67 | 67 | <bizlog-sdk.version>3.0.6</bizlog-sdk.version> |
| 68 | 68 | <mqtt.version>1.2.5</mqtt.version> |
| 69 | 69 | <pf4j-spring.version>0.9.0</pf4j-spring.version> |
| 70 | - <vertx.version>4.4.0</vertx.version> | |
| 70 | + <vertx.version>4.5.11</vertx.version> | |
| 71 | 71 | <!-- 三方云服务相关 --> |
| 72 | 72 | <okio.version>3.5.0</okio.version> |
| 73 | 73 | <okhttp3.version>4.11.0</okhttp3.version> | ... | ... |
yudao-module-iot/yudao-module-iot-plugin/yudao-module-iot-http-plugin/pom.xml
| ... | ... | @@ -127,7 +127,7 @@ |
| 127 | 127 | <!-- 其他依赖项 --> |
| 128 | 128 | <dependency> |
| 129 | 129 | <groupId>org.springframework.boot</groupId> |
| 130 | - <artifactId>spring-boot-starter-web</artifactId> | |
| 130 | + <artifactId>spring-boot-starter</artifactId> | |
| 131 | 131 | </dependency> |
| 132 | 132 | <!-- PF4J Spring 集成 --> |
| 133 | 133 | <dependency> | ... | ... |
yudao-module-iot/yudao-module-iot-plugin/yudao-module-iot-http-plugin/src/main/java/cn/iocoder/yudao/module/iot/HttpPluginSpringbootApplication.java
| ... | ... | @@ -5,7 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 5 | 5 | |
| 6 | 6 | @SpringBootApplication |
| 7 | 7 | public class HttpPluginSpringbootApplication { |
| 8 | + | |
| 8 | 9 | public static void main(String[] args) { |
| 9 | 10 | SpringApplication.run(HttpPluginSpringbootApplication.class, args); |
| 10 | 11 | } |
| 12 | + | |
| 11 | 13 | } |
| 12 | 14 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-plugin/yudao-module-iot-http-plugin/src/main/java/cn/iocoder/yudao/module/iot/config/TestConfiguration.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.config; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.api.device.DeviceDataApi; | |
| 4 | +import cn.iocoder.yudao.module.iot.api.device.dto.DeviceDataCreateReqDTO; | |
| 5 | +import cn.iocoder.yudao.module.iot.plugin.HttpVertxPlugin; | |
| 6 | +import org.pf4j.DefaultPluginManager; | |
| 7 | +import org.pf4j.PluginWrapper; | |
| 8 | +import org.springframework.context.annotation.Bean; | |
| 9 | +import org.springframework.context.annotation.Configuration; | |
| 10 | + | |
| 11 | +// TODO 芋艿:临时实现; | |
| 12 | +@Configuration | |
| 13 | +public class TestConfiguration { | |
| 14 | + | |
| 15 | + @Bean | |
| 16 | + public DeviceDataApi deviceDataApi() { | |
| 17 | + return new DeviceDataApi() { | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public void saveDeviceData(DeviceDataCreateReqDTO createDTO) { | |
| 21 | + System.out.println("saveDeviceData"); | |
| 22 | + } | |
| 23 | + | |
| 24 | + }; | |
| 25 | + } | |
| 26 | + | |
| 27 | + // TODO @haohao:可能要看下,有没更好的方式 | |
| 28 | + @Bean(initMethod = "start") | |
| 29 | + public HttpVertxPlugin HttpVertxPlugin() { | |
| 30 | + PluginWrapper pluginWrapper = new PluginWrapper(new DefaultPluginManager(), null, null, null); | |
| 31 | + return new HttpVertxPlugin(pluginWrapper); | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-plugin/yudao-module-iot-http-plugin/src/main/resources/application.yml