Home > Software design >  Organise a springboot project from scratch
Organise a springboot project from scratch

Time:07-17

I'm just starting to learn java springboot and I want to start a project from scratch (means I don't want the IDE to generate the needed files and config for me).

So far I know springboot:

  • read the pom.xml file from the root
  • check the src/main/java folder for any application

is there any advice how I can organize my project, if I want to adopt a MVC approach?

CodePudding user response:

pom.xml only is required for Maven projects, not mandated by Spring. You could use Gradle, SBT, or any other JVM dependency manager, or you could manage the classpath yourself with custom Jars.

It is Maven, Gradle, etc that dictate the src/main/java default directory structure, not the IDE or Spring.

You don't necessarily need the IDE to do it, but you should use Spring Initializer as this will keep all your dependencies consistent and give you the recommended project structure.
Otherwise, you need to ensure that you download all necessary dependencies yourself, then create your main class/method that invokes the Spring Application runner, but that could be in any folder structure, and you could use javac to compile it.

  • Related