In Spring 4, it is possible to configure bins via the Groovy config . I define the bin in the same way as I would do it in XML using the DSL groove, the config groove lies in the resources:

beans { logReader(FileLogReader) } 

Then I import it into the main Java config via the @ImportResource annotation.

 @ImportResource({"classpath*:beansconfig.groovy"}) 

But Idea does not understand that these beans are in context when I try to bind them through @Autowired (the environment displays the Could not autowire , because it does not see the bean with that name).

Could not autowire

The application itself runs without problems. How to set up the project so that the idea recognizes Groovy-configs or does it not understand this method of defining bins at all? And how common is this method? I saw YouTube reports saying that Groovy configs combine the flexibility of Java configurations and the ability to change them without recompiling (as XML configs). However, I did not see many people using this configuration method, in addition, the environment does not really support it either (perhaps I am doing something wrong).

    1 answer 1

    I do not quite understand why you java config to pull bins in java config , which are described as groovy config .

    If you want to use the groovy config , then use the GenericGroovyApplicationContext context immediately.