Good Day Everyone!
Just wanted to ask if it is possible to use jars built using spring xml as libraries inside a spring boot project?
I currently have a legacy project that was built using spring xml and hibernate (without spring-data-jpa) and I am currently searching for a way to use jars compiled from that legacy project as libraries inside a newer spring boot (with spring-data-jpa with hibernate) microservice project that we are trying to build. Has anyone ever tried to do the same? is it possible?
CodePudding user response:
Yes, there should be no problem with it.
Probably, you just need to import spring xmls with @ImportResource
annotation.
CodePudding user response:
I'm going to propose a maven based solution here, if you're using something else for dependency management, diregard the specifics.
What you're trying to do should be doable i think. If you have built jars which you're not really updating i assume (hence the legacy part), then in maven you're able to make a maven repository for the project which you can point to in the regular GAV format, after having put the repository information in your settings file.
It is a must that you use this repository as read only. This method is not an offical solution, and you will have problems with concurrent access.
The proper way would be putting it in an artifact manager like Nexus or Artifactory, and pointing to that as an extra repository other than the maven central one.
We're using the former solution since there's no real need for artifact management yet, and we also have some legacy stuff stored there(mainly APIs and "commons" stuff). It's read only and not being accessed by more the 1 or 2 people at a time.
For the former solution here's the settings.xml
repository part in a windows environment:
<repository>
<id>id</id>
<name>name</name>
<url>file://///your/path/to/repository</url>
<layout>default</layout>
</repository>