Spring Boot and Eureka: eureka.client.healthcheck.enabled property not found - spring-boot

I have a Spring Boot Hystrix dashboard application where in a .property file I am trying to define some key/value pair(s) ― as per tutorial: https://exampledriven.wordpress.com/2016/07/05/spring-cloud-hystrix-example/
I am getting error when adding property eureka.client.healthcheck.enabled = true. The editor complains with:
Unknown property 'eureka.client.healthcheck'
Please, help me to find out the correct dependency, or if I am missing anything else.

Related

Cannot find template location :( please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)

I created a spring boot application and while running it I am getting this warning.
2022-10-27 00:35:12.520 WARN 11512 --- [ restartedMain] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
Here, you can see my application.properties file
spring.datasource.url=jdbc:mysql://localhost:3306/springbootblogapp?
createDatabaseIfNotExist=true
spring.datasource.username=root
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=true
spring.jpa.open-in-view=false
Even though there were some related questions here, the provided answers for them are not working for me, because the warnings mentioned there were a little bit deviated from the warning which I got.
Please help me.
My initial comment, transferred to an answer:
Here is the text of the warning message shown in your question:
2022-10-27 00:35:12.520 WARN 11512 --- [ restartedMain] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
Did you try what the warning message suggests - for example, by adding:
spring.thymeleaf.check-template-location=false
to your application's config? Or by creating the directory templates mentioned in the warning message (and adding a template there)? By default this directory is expected to be created in the resources location, so that it is on the classpath of the application at runtime.
Update based on your follow-up comment:
Why do you get this warning?
When you create a Spring Boot application, you can choose various additional dependencies (for example by using Spring Initializr).
One such additional dependency is Thymeleaf.
For Maven (assuming you are using Maven), that is the following artifact in your POM:
<artifactId>spring-boot-starter-thymeleaf</artifactId>
There is no point in choosing this option if you don't set up the basic location where you are going to store your Thymeleaf templates.
If you choose to configure the option:
spring.thymeleaf.check-template-location=false
then you are telling Spring not to bother checking if there is a valid configured location for your Thymeleaf templates.
So, even if there is not a valid configured location, you won't see that warning.
If you decide you do want to use Thymeleaf after all, you will need to fix this, by providing that default folder templates on the runtime classpath - or by specifying a custom location via your properties file.
You may see similar warnings (or even errors) with other Spring Boot dependencies you have chosen. For example, if you choose to include the JDBC API, but do not configure a valid data source, then I believe that causes an error (if I recall).

Custom application property to be supplied to spring boot app through cmd line

I was wondering if we can supply a custom attribute (a key to be in application.properties file), I know for sure that -Dserver.port=8080 works, and overrides the property value, but server.port is a spring boot's expected property value.
How about something other than that, for example a jdbc connection string or service name? does -Ddb.service.name=dbservice work?
Yes, any property can be set via system property. You can use -D or -- notation. There are also a variety of property sources Spring Boot uses:
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

Meaning of ${xxx:yyy} on Spring Boot application.properties

I see following in Spring Boot application.properties file. What is it doing here:
spring.datasource.password = ${DB_PASSWD:password}
It means try resolving DB_PASSWD property. If found, use it's value. If not, use the default provided value password. In short:
${property:defaultValue}
The property value is looked up from property sources registered in Spring context, see Environment.getProperty() and #PropertySource.

jasypt encryption not working in spring boot

I want to do encryption for some sensitive data in application.properties file of spring boot application.
for that I have used jasypt-spring-boot-starter plugin .
also used #EnableEncryptableProperties tag on spring application.
I have encrypted access key for my database and written its encrypted value in the property file.
com.test.SharedAccessKey=ENC(vfQQ9veC1G+RV8BC0VA==)
also provided in property file
jasypt.encryptor.password=secretpassword
jasypt.encryptor.algorithm=PBEWithMD5AndDES
I am accessing this property in spring boot application as followes
#Value("${com.test.SharedAccessKey}")
public String shareAcessKey;
But logger.info(shareAcessKey) print as it is ENC(vfQQ9veC1G+RV8BC0VA==)
what I am missing in above , can anyone help.
Issue was resolved . I have done some configuration in my spring Configuration class #Configuration related to property file.
as set property place holder configure to setIgnoreUnresolvablePlaceholders
after removing above code . Jasypt password is got picked up.

Set hibernate.id.new_generator_mappings in application.yaml

I am trying to set the hibernate.id.new_generator_mappings property in order to use SequenceStyleGenerator, as I'm getting deprecation warnings for SequenceHiLoGenerator after upgrading to Spring Boot 1.4.0.RELEASE.
I tried adding the following entry to application.yaml but it has no effect:
spring:
jpa:
hibernate:
id:
new_generator_mappings: true
I also tried converting to application.properties file:
spring.jpa.hibernate.id.new_generator_mappings=true
Stepping through the JpaProperties class I can see where it's trying to parse the hibernate.id.new_generator_mappings property, but it is missing.
Is this a bug in Spring Boot, or do I have something configured incorrectly?
The correct setting, per the upgrade guide is:
spring.jpa.hibernate.use-new-id-generator-mappings

Resources