| | |
| | | package com.moral.config; |
| | | |
| | | import com.moral.service.AccountService; |
| | | import com.moral.service.DeviceService; |
| | | import com.moral.service.SensorService; |
| | | import com.moral.webSocketServer.*; |
| | | |
| | | import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; |
| | | import org.springframework.amqp.support.converter.MessageConverter; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.socket.server.standard.ServerEndpointExporter; |
| | |
| | | @Configuration |
| | | public class WebSocketConfig { |
| | | |
| | | @Bean |
| | | //本地测试需要将注释解开 |
| | | /*@Bean |
| | | public ServerEndpointExporter serverEndpointExporter() { |
| | | return new ServerEndpointExporter(); |
| | | } |
| | | }*/ |
| | | |
| | | @Bean |
| | | public MessageConverter jsonMessageConverter() { |
| | | return new Jackson2JsonMessageConverter(); |
| | | } |
| | | |
| | | @Autowired |
| | | public void setMessageService(DeviceService deviceService){ |
| | | WebSocketServer.deviceService=deviceService; |
| | | WebSocketServerNew.deviceService=deviceService; |
| | | BSWebsocketServer.deviceService=deviceService; |
| | | BSAQIWebSocketServer.deviceService=deviceService; |
| | | BSAQIWebSocketServerTest.deviceService=deviceService; |
| | | } |
| | | @Autowired |
| | | public void setMessageService(AccountService accountService){ |
| | | ElectronicSWebSocketServer.accountService=accountService; |
| | | } |
| | | @Autowired |
| | | public void setSensorService( SensorService sensorService){ |
| | | BSWebsocketServer.sensorService=sensorService; |
| | | BSAQIWebSocketServer.sensorService=sensorService; |
| | | ElectronicSWebSocketServer.sensorService=sensorService; |
| | | BSAQIWebSocketServerTest.sensorService=sensorService; |
| | | ElectronicSWebSocketServer.sensorService=sensorService; |
| | | } |
| | | |
| | | } |