1

I'm building a backend service powered by Spring Batch which enables to define and Jobs.

Currently, I have several jobs, that essentially, aren't related one to another.

So,

  • I have one application.properties file that contains all the properties for all jobs
  • Packages are bloated with classes that aren't related to each other.

So I thought about separating Jobs to different Maven modules and to have an engine module that gathers them all to one jar.

The problem I was facing is that Spring wouldn't load automatically these application.properties from the other modules.

i.e. $Value("${some.module.property}") will fail the application (engine.jar) as this property isn't found in the application.properties of the engine module.

I've understood that there might be some solutions for that problem, but my main question is:

Is it a good idea to make this separation, or is it bearable to have all the classes and configurations in one single project?

1

Both are acceptable. The question are what are your outcome ? What do you want to achieve?

Here you talk about going to a modular monolith. It could be the last step before going to a microservice deployment approach (each job is completely independent.. build, deploy and run separately).

To respond to your question: sounds a good solution if for instance :

  • you want to assign different owner by module(aka developer) and push forward Team/Job autonomy..
  • decrease the build time, code-quality review time(like sonar review) that take too long when apply to a global package.
  • Improve cohesion and decrease risk of coupling that could appear by sharing some code between job implementations

Another question could be why these jobs are packaged together if they aren't chained?

Maybe they could be completely split and going with each job having their own lifecyle and being independently deployable and runnable --> so one fat-jar by job

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.