Spring Load External Configuration in Groovy

How to get Spring boot to load external properties for Groovy? Do you need something similar to the java mechanism (application.properties in resources and ConfigBean with @Value annotations)?

When trying to use the same mechanism as with java, I do not know how to comment on the ConfigBean file

@Component
public class ConfigBean {
    @Value("${seleniumAddress}")
    private String seleniumAddress; ...

and then in application.properties

seleniumAddress=http://localhost:4444/wd/hub

groovy but I can not annotate a field with the help @Value("${seleniumAddress}" He gives an error message "$ {}" - is a special sequence in groovy. So what mechanism should I use here?

thank

+4
source share
1 answer

"$ {}" Spring Groovy, , String ( GString): , "$ {}" ( ).

+12

All Articles