Closed michaelrice closed 10 years ago
I guess I should mention this fixes issue #8
yes, it did... might I suggest adding comments about updating Config.groovy to the readme since it appears that this property is not set by default.
You shouldnt need to set it. Normally not setting it is better. Since grails 2.x grails does a really great job of figuring out that value on its own. I only have 1 application where we have to use it and its due to some fancy proxy passing we do to hide where it really is.
If you dont define it in your config is it getting the value wrong?
Just for some reference: http://stackoverflow.com/questions/8933356/how-do-i-set-grails-serverurl-in-an-enterprise-environment-when-i-dont-know-the
Burt Beckwith explains in his answer.
Its also mentioned in the upgrading from previous versions of grails guide: http://grails.org/doc/2.0.x/guide/single.html#upgradingFromPreviousVersionsOfGrails
Awesome work @michaelrice. Thanks!! ;-)
Without the changes to Config.groovy I get the following exception when running
grails run-app
Exception:
| Error 2013-10-25 14:56:01,815 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'swaggerConfig': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'basePath'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'basePath': no matching editors or conversion strategy found
If I try to build with maven
mvn clean install
without the following in Config.groovy (with the changes below mvn clean install works)
test {
grails.serverURL = "http://localhost:8080"
}
I get the error:
|Environment set to test
..............................................................
|Running 5 unit tests...
|Completed 0 unit test, 0 failed in 0m 1s
........Error
|
Fatal error running tests: Error creating bean with name 'swaggerConfig': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'basePath'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'basePath': no matching editors or conversion strategy found (Use --stacktrace to see the full trace)
.Tests FAILED
@pherris That is rather annoying. I didnt even realize I had this defined for development. I was looking through the swagger sources and it looks like there really isnt going to be a way to avoid defining that value which is a big downer for me.
Ill update the readme again to include the note about the config. Thanks for your feedback.
updated readme to use resources.groovy instead of applicationContext to define bean