Demo code for jCafe about Java 9
steps of making a hexagonal architecture
anderskristian/empty-application 0
Application that demonstrates that Spring Boot applications are empty by design
issue closedzyro23/grails-spring-websocket
lookupDestination mapping does not work by default in grails controller
using: implementation "org.grails.plugins:grails-spring-websocket:2.4.1"
with: grails 3.3.1 os win 10 java se 1.8.0_112
Test case in https://github.com/aabjava/TWebsockets
import org.springframework.stereotype.Controller
@Controller
class WebsocketController {
@MessageMapping("requestcontroller")
@SendTo("replycontroller")
protected String reply(){
return "This is a websocket reply"
}
}
This works and can be seen in console log output, message handlers are found in class
class Websocket2Controller {
@MessageMapping("requestcontroller2")
@SendTo("replycontroller2")
protected String reply(){
return "This is a websocket reply2"
}
}
Above does not work and method mappings are ignored.
I actually think this is better than scanning all the controllers methods for mapping (what appears to be the case) , but this is not stated in the docs and can be confusing.
Also i don't know if using org.springframework.stereotype.Controller in a grails controller will break any of the default for grails controllers it does not seem to
closed time in 2 months
aabjavaissue commentzyro23/grails-spring-websocket
lookupDestination mapping does not work by default in grails controller
Yes it can.
Thanks for the quick response,
I now cannot reproduce either, don't know what happened.
Updated sample, now controller that has the spring annotation is called twice for the topic, but i guess that makes sense.
Thanks
comment created time in 2 months
issue commentzyro23/grails-spring-websocket
lookupDestination mapping does not work by default in grails controller
cannot reproduce.
added logger("grails.plugin.springwebsocket", DEBUG, ["STDOUT"], false) to your sample app.
console out:
DEBUG --- [ main] GrailsSimpAnnotationMethodMessageHandler : 1 message handler methods found on class com.test.Websocket2Controller: {protected java.lang.String com.test.Websocket2Controller.reply()={[/requestcontroller2],messageType=[MESSAGE]}}
INFO --- [ main] GrailsSimpAnnotationMethodMessageHandler : Mapped "{[/requestcontroller2],messageType=[MESSAGE]}" onto protected java.lang.String com.test.Websocket2Controller.reply()
by default all grails controllers will be scanned. https://github.com/zyro23/grails-spring-websocket/tree/2.4.x#usage:
Those annotations can be used in:
- Regular Grails controllers
WebSocketGrails artefacts (grails create-web-socket my.package.name.MyWebSocket)- Spring
@Controllerbeans
if thats an issue for you, refer to https://github.com/zyro23/grails-spring-websocket/tree/2.4.x#startup-performance
can this be closed?
comment created time in 2 months
issue openedzyro23/grails-spring-websocket
lookupDestination mapping does not work by default in grails controller
using: implementation "org.grails.plugins:grails-spring-websocket:2.4.1"
with: grails 3.3.1 os win 10 java se 1.8.0_112
Test case in https://github.com/aabjava/TWebsockets
import org.springframework.stereotype.Controller
@Controller
class WebsocketController {
@MessageMapping("requestcontroller")
@SendTo("replycontroller")
protected String reply(){
return "This is a websocket reply"
}
}
This works and can be seen in console log output, message handlers are found in class
class Websocket2Controller {
@MessageMapping("requestcontroller2")
@SendTo("replycontroller2")
protected String reply(){
return "This is a websocket reply2"
}
}
Above does not work and method mappings are ignored.
I actually think this is better than scanning all the controllers methods for mapping (what appears to be the case) , but this is not stated in the docs and can be confusing.
Also i don't know if using org.springframework.stereotype.Controller in a grails controller will break any of the default for grails controllers it does not seem to
created time in 2 months