How to add properties file to classpath in Grails

时间:2015-10-06 08:50:51

标签: grails

What does it mean when it says to add a file to the classpath? Something like this:

// The configuration file we created. It must be in the classpath.
outEncryptionProps.put(WSHandlerConstants.ENC_PROP_FILE, "client_encryption.properties");

I use GGTS and I have other files other than properties file that I need to add to my project's classpath.

1 个答案:

答案 0 :(得分:4)

类路径是用于解析类和资源的jar和目录的集合。实际上,对于这样的文件,将它们放在类路径中意味着您应该将它放在包含在类路径中的目录中,或者在编译期间将其内容复制到类路径文件夹的目录。

在Grails中,您可以将非源文件放在grails-app/confsrc/javasrc/groovy中,然后将它们复制到类路径中。