Search code examples
javaspringtechnical-debt

Spring Java project with 4000+ sources


I am currently working as freelance on a Spring / AngularJS project. I never worked on a such project.

It has 4000+ java sources, heading to 5000 by the end of the year.

AngularJS project with also thousand of componants, is expected to be migrated to a more recent frontend framework. It's served by the Java webapp folder.

I think I am alone to be seriously annoyed by project's size and lack of modularization.

My questions :

  • Is there any technical limitation to sources file count on a Spring Project ? (except that build time is long and it's difficult to be productive)
  • Might the build (or the run), crash at some point ?

Solution

  • Regarding the size of your application in general, it's difficult to judge it without knowing more about its underlying architecture. I'm sure this topic would attract a lot attention from the monolithic vs microservices architecture camps.

    To address your questions:

    1. I've never heard of or experienced a physical limit on the number of files in a Spring project. As you rightly pointed out, the factors such as compilation, build and packaging times are likely to be affected by the project size.

    2. Since the metadata for the Java classes is stored in a dedicated place in the Java memory, you may need to tune the relevant Heap, PermGem (Java 7), MetaSpace(Java 8+) settings to avoid a potential OutOfMemory error.

      If you run your code in an application server such as WebLogic and you can hot-deploy the application multiple times without shutting down the server, you may also experience OutOfMemory due to a potential storage leak that can gradually build up and fail to be garbage collected.

      You may also need to tune the above memory settings for the execution of the integration tests that require an instance of the application server to be created on the fly (e.g. Tomcat with Spring Boot) as the default JVM settings may not be sufficient.