Search code examples
javaintellij-ideagradlespring-messaging

Can not import package org.springframework.messaging and use MessageHandler interface


I have spend quite some time trying to figure out how do I import and use MessageHandler interface from spring framework. So here is what I do with my IntelliJ Idea IDE:

import org.springframework.messaging;

@EnableWs @Configuration public class WebServiceConfig extends WsConfigurerAdapter implements MessageHandler { ...

Furthermore, I have tried to setup my build.gradle script, in order to teach my IDE to use spring-messaging as follows:

compile("org.springframework.spring-messaging:spring-boot-starter-web-services")

or according to this:

compile("org.springframework.spring-messaging:4.0.0.RELEASE")

None of my desperate attempts was successful.. I can't even see relevant library among my External Libraries listed. Can anybody tell me what am I screwing up ?

Many thanks...


Solution

  • Neither dependency coordinates you use properly.

    Let's go to the Maven Search and copy & paste it from there!

    compile 'org.springframework.boot:spring-boot-starter-web-services'
    

    https://search.maven.org/#artifactdetails%7Corg.springframework.boot%7Cspring-boot-starter-web-services%7C1.5.6.RELEASE%7Cjar

    compile 'org.springframework:spring-messaging:4.3.10.RELEASE'
    

    https://search.maven.org/#artifactdetails%7Corg.springframework%7Cspring-messaging%7C4.3.10.RELEASE%7Cjar

    Now you have to reimport the Gradle project to your IDE to make it understand what you provide with the dependency management.