Spring JPA Multiple "schema-xx.sql" files? - spring-boot

I'm developing Spring Boot / -JPA application. By default, Spring-Boot loads "data-${platform}.sql" and "schema-${platform}.sql" automatically when the application is started. I found several notes about how to split a single "data-${platform}.sql" file into multiple files and how to use these "data"-files from Spring Boot. But what about "schema-${platform}.sql" files? My current "schema-${platform}.sql" has become quite large and thus confusing. The question now is, if I can split these "schema-sql" file into several files and what do I have to configure in my corresponding JPA classes?
Thanks a lot!

Related

Why that Spring Framework Documentation's table of contents is gone?

I remember there was a table of contents in the document before but now is gone.
That makes it inconvenient to find the specified chapter.
And I see the other's project still has the table of contents.
Is it something wrong with this doc page?
Spring Framework Documentation:
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html
And others project like Spring Boot :
https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features
I have the same symptoms, but with Spring Framework project, not Spring Boot. I managed to download PDF versions of the topics. They're at:
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/core.pdf
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/testing.pdf
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/data-access.pdf
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/web.pdf
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/web-reactive.pdf
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/integration.pdf
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/languages.pdf
https://docs.spring.io/spring-framework/docs/5.3.9/reference/pdf/appendix.pdf
Both links lead to Spring features

How can I configure a Spring Boot app to use two message properties files?

I have a Spring Boot app that pulls messages from messages.properties and its language-specific partners (e.g. messages_fr.properties for French users). I'd like to add a second set of messages files, for messages that are shared across several of my organization's applications. Let's call it commonmessages.properties (and commonmessages_fr.properties etc.).
How can I tell Spring Boot to use both files for messages?
As seen in an example in this Spring Boot "features" overview, you can set the property spring.messages.basename in application.properties or application.yml to a comma-separated string.
In this case:
spring.messages.basename=messages,commonmessages
EDIT: I did a bit of testing and it seems like the entry listed first has precedence, i.e., if messages of the same name are found in both files, the app will use the one from messages and not the one from commonmessages.

Is there a way to generate application properties when creating a Spring Boot project?

I'm planning to run our own Spring Initializr instance. Is there a way to have a set of application properties get written (to application.yml) when a certain option is chosen, ideally in a separate section for each of a set of predefined profiles? I've looked into customising the project-generation process in Initializr and at creating a custom starter. I've come across auto-configuration for starters, but that seems to be about what configuration to default to when this has not been provided by properties, whereas I am after generating the properties. I've also come across an example of a custom Spring Initializr instance generating files, but I need it to modify application.yml without clobbering any other modifications that may have been made to it.
Spring Initializr (the library behind start.spring.io) does not have yaml support and does not allow you to write such file automatically when the project is generated.
It's easy enough for you to add that feature though. The way it works is through a model that contributors would tune + a writer that transform the model into the target output. An analogy of this would be MavenBuild and MavenBuildWriter that generates Maven's pom.xml.
Auto-configuration is indeed completely unrelated to code/configuration generation so no need to look there.

Loading multiple Profile based properties inside custom folder using Spring-Config Cloud Server

I am new to spring boot, have come across a situation...
l have 10 different property files based on various logical modules of a monolith application(db.properties,jms.properties, etc) and 7 envs(pre, sit1,sit2,uat1,uat2,prod, dr). The idea of having diffrent property files so that we can use them almost with no change whenever we move to microservice based approach.
One approach says - we use various spring application names
like - spring.application.name=db,jms,a,b .....
In this way we will land up having 10×7 = 70 files under same folde? (In order to make it profile driven) like jms.properties,jms-dev.properties,jms-uat.propetris...... for all various logical modules.
Is there any better approach to host the files using config server?
We have a monolith application and we plan to continue the same for the time being.
I am struggling to build such facility using spring cloud config server...if any one can help

What is the best way to design file handling using spring

I want to make an application is which file handling is used. That is file downloading (get the file), file parsing(process the file) and file uploading. It is not a web project. Actually the idea is we make this project and then make a jar of it and then use it in our further projects. How can i design my application so it is extendable easily in future. Is there is any spring framework for this task?
Thanks
I would suggest either Spring Batch or Apache Camel. These two frameworks can automate the downloading/uploading functionality you are after and let you define the file parsing in a well structured manner. If you are after csv or line-by-line parsing it's already done for you and you'll be at the file parsing bit just with a few configuration. Take a look at the Spring Batch sample examples and Apache Camel examples as a starting point.

Resources