0

I have a very simple Groovy script:

import org.springframework.*;

@groovy.transform.ToString()
@Controller(name="myHomeController")
class HomeController {

    String home() {

    }
}

As I use the @Controller annotation I used the menu option:

Script -> Import jars into classpath

But when compliging I receive the error:

1 compilation error:

unable to resolve class Controller ,  unable to find class for annotation
 at line: 2, column: 1

What is the correct way to use Spring Framework from the groovyConsole?

4

1 回答 1

1

For @Controller annotation you need to import:

import org.springframework.stereotype.*
于 2018-10-17T08:43:20.830 回答