I add some custom attributes which contains Chinese in a Spring Boot project. However, the attributes show the wrong way.
I use the idea and set file encoding with utf-8.
Oh, and I am using YAML instead of Properties
What should I do?
oh, there is no problem.I use the Properties file before, and change to YAML.
So, it shows wrong situation.
I solve the problem by cleaning the project and restarting it.
Related
I found a solution to do it via Java code here:
https://docs.spring.io/spring-batch/docs/4.2.x/reference/html/job.html#configuringJobRepository
But, I want to do it if possible in a simple way via configuration in yaml format in the batch configuration file.
Thank you.
As far as I know, there is currently no such property in yaml available.
There is an open feature request in Spring Boot (https://github.com/spring-projects/spring-boot/issues/28802) that may result in a property like spring.batch.jdbc.isolation-level-for-create in the future. Until then, you'll need to use Java (or XML) configuration.
In spring boot 2.4, later loaded properties override earlier properties.
But, for my need, I am importing document inside document using spring.config.import. Say, import abc.properties from application.properties.
But, I need to override, later loaded properties with earlier loaded ones.
Say, application.properties should override abc.properties. not the other way arpund.
Please help me on how to do this.
Thanks in advance.
I resolved the issue with EnvironmentPostProcessor, as it seems to be not doable simply with spring.config.import.
As, both yaml (and in terns json) and properties, property source parser is readily available in spring boot, this required very little coding.
Setup:
Intellij IDE community
Spring Boot 2.4.0
Spring rest docs
Hi,
I use spring rest docs in all my services. The problem is that in one of them, the custom snippets are ignored and I just don't know why. Although if i'm sure that it's a mistake of mine I just can't find it.
Example snippet
One of the snippets I want to customize is the http request.
So I placed a file http-request.snippet under src/test/resources/org/springframework/restdocs/templates/asciidoctor
Content:
[source,http,options="nowrap"]
----
{{method}} {{path}} HTTP/1.1
----
So I would expect that the requestbody is not documented in this snippet but instead it is still included.
Like I said all my snippets are ignored.
UPDATE:
I've debugged StandardTemplateResourceResolver class. In fact, my templates are ignored.
I looked at the path and as you can see the method getFormatSpecificCustomTemplate should resolve my snippets but it doesn't.
Is there something else I have to configure when I add a new resource folder and I add it to the classpath?
SOLVED
I found the problem by looking at the asciidoc path in my explorer. The problem was that the creation of the direktories went wrong. Instead of creatin nested subdirectories for org/springframework/.. there was one folder with the whole directory structure as one name. Sorry for the confusion but in intellij the structure looked right.
I have YAML file that has a list, the values allowed in that list are defined in an Enum in that project.
Is there anyway I can help the user with autocompletion when opening the file in intellij? I know Spring boot to do this in some way.
Such auto completion is currently not provided in YAML configuration files, but .properties files only. Please watch https://youtrack.jetbrains.com/issue/IDEA-151708 for progress.
I have a Gradle based Spring Boot application which requires an external properties file. Fortunately, Spring Boot automatically looks for an application.properties file in a /config folder by default, so I put that in the module root and it works fine. However, it seems that IDEA's inspection is marking everything in this file as "Unused Property". If I move the file to /src/main/resources the inspections work properly.
So, what is the best practice when working with these external properties files? Is there something I can set in the build.gradle to get IDEA to recognize the properties or some setting in IDEA? I've tried playing around with the Spring Facets in the project settings, but can't seem to figure it out.
Thanks!