gorm


spring-boot property exception while externalizing datasource properties and using actuator


Im creating a small application using spring-boot + gorm + sqlserver datasource (very similar to Tim Yates' https://github.com/timyates/data-gorm-mysql/).
My datasource properties are in application.properties:
dbDriverClassName=...
dbUsername=...
My build.gradle has
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.grails:gorm-hibernate4-spring-boot:1.0.0.RC1")
It works fine. But when I add the actuator to build.gradle, I get errors:
compile("org.springframework.boot:spring-boot-starter-actuator")
UPDATE (full stacktrace)
thread "main" org.springfra
mework.beans.factory.BeanCreationException: Error creating bean with name 'environmentEndpoint': Could not bind properties; nested exception is org.springframework.beans.NotWritablePropertyException:
Invalid property 'dbUsername' of bean class [org.springframework.boot.actuate.endpoint.EnvironmentEndpoint]: Bean property 'dbUsername' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:321)
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:278)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
2014-04-05 08:40:09.661 INFO 8136 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report enabled debug logging (start with --debug)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context..AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:619)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:880)
at org.springframework.boot.SpringApplication$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at gov.texas.iph.IphApplication.main(IphApplication.groovy:25)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'dbUsername' of bean class [org.springframework.boot.actuate.endpoint.EnvironmentEndpoint]: Bean property 'dbUsername' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1064)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:922)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:82)
at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:728)
at org.springframework.validation.DataBinder.doBind(DataBinder.java:624)
at org.springframework.boot.bind.RelaxedDataBinder.doBind(RelaxedDataBinder.java:84)
at org.springframework.validation.DataBinder.bind(DataBinder.java:609)
at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfiguratory.java:275)
at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:225)
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:318)
... 21 more
:bootRun FAILED
What am I missing?
Thanks!
Solution:
I changed the build.gradle line from RC1 to RC2 and there is no error now (tested switching back to RC1 to confirm error, and back to RC2 - no error).
compile("org.grails:gorm-hibernate4-spring-boot:1.0.0.RC2")
#Dave, thanks for the tip. But why do you say there is no reason to use custom DataSource, is there a better way?
I should have looked at repo.spring.io for latest version, but the stacktrace made me think it was an issue with actuator environment.

Related Links

What happens when two app servers in cluster start LiquiBase update (via Grails)?
use of mappedBy in Many to Many relationship in Grails
Domain class auto validation in grails
Grails Detached Criteria Query and “group by” and “having” clause
Script for saving large no of entries in mongodb
Does the multiple datasource feature of Grails 2.0 support relations?
How to avoid ImprovedNamingStrategy in joinTable in Grails
Grails 2 Show transient property that is an alias for id column
How to save GORM class with composite id made from its own field?
Grails - 2 domains and 1 form create/update/edit issues
Is there a belongsTo mixed syntax for GORM many-to-many and back-reference
Why do these Gradle tests throw exceptions?
In grails 2 when using multiple datasources, can I specify which datasource a criteria should use?
GORM methods are not accessible in Domain and Service classes
How to initialize the domain class properties with the values of another Domain class properties in grails
Grails Domain Embedded

Categories

HOME
atom-editor
coq
google-api-php-client
iterator
pivotal-cloud-foundry
opengl-es-2.0
virtualization
session-variables
metatrader4
izpack
imacros
mapserver
windows-7-x64
google-static-maps
http-status-code-504
django-cms
orleans
csrf-protection
css-animations
devops
cultureinfo
microsoft-sync-framework
fish
bootstrap-material-design
typo3-6.2.x
quote
flink-streaming
binary-data
http-status-code-503
xquery-3.0
stringtemplate
form-data
mozilla
amazon-kinesis-kpl
swift3.0.2
sas-visual-analytics
google-closure
http-live-streaming
arena-simulation
import-from-excel
long-polling
zip4j
multipeer-connectivity
hendrix
python-webbrowser
composite-key
libusb-win32
windows-mobile-6.5
akka-cluster
jspdf-autotable
dwscript
minimization
query-performance
angular-strap
nested-sets
medium.com
adxstudio-portals
pcf
nsfilemanager
etsy
flash-cs5
sigabrt
superstack
master-slave
execute
cartesian-product
lemon
ora-00900
iis-arr
coveralls
ami
e10s
jsonpickle
mdt
cctv
codeigniter-routing
ceil
rebol3
typo3-neos
commoncrypto
bulkloader
flash-builder4.5
mqx
mt
pysimplesoap
labwindows
viewswitcher
vdsp
coredump
winbugs14
disclosure
mirah
zend-tool
exchange-server-2003
text-coloring
ntvdm.exe

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App