Spring Boot - Exploded project structure

[Updated: Jan 15, 2017, Created: Jan 15, 2017]

A Boot application can run in an exploded form just like a plain application runs in IDE. We can run it using Exec Maven Plugin. We can also use Spring Boot Maven plugin's run goal which can quickly compile and run our application in exploded form.

In this tutorial we are going to demonstrate both uses to understand the project structure involved.

Using mvn exec:java to run boot application

Let's create a simple boot project:

@SpringBootApplication(exclude = {JmxAutoConfiguration.class})
public class Main {
    public static void main (String[] args) {
        SpringApplication sa = new SpringApplication(Main.class);

        ApplicationContext c = sa.run(args);
        MyObject bean = c.getBean(MyObject.class);

    private static class MyObject {

        public void doSomething () {
            System.out.println("working ...");

Note that, we have excluded JmxAutoConfiguration.class to reduce the logging outputs.


<project ....>





Note that we added the property "start-class", that's because spring-boot-starter-parent's pom.xml, has the following plugin added:


That means if we don't provide start-class property, our mvn exec:java won't work as expected.

Let's compile and run our project using mvn exec:java

Above we got the expected output from our main class.

Using spring-boot:run

Add mvn plugin in pom.xml:

<project ...>

We saw in above example there's nothing special about boot project structure when it comes to run the application in exploded form. Both exec:java and spring-boot:run work in the same way. What if we want to create an executable jar? Should we use maven-assembly-plugin to create a 'fat jar'? In the next tutorial we will attempt to do that and see how maven assembly and spring-boot plugins take the different approaches to create an executable jar.

Example Project

Dependencies and Technologies Used :

  • spring-boot-starter 1.4.2.RELEASE: Core starter, including auto-configuration support, logging and YAML.
    Corresponding Spring version: 4.3.4.RELEASE
  • JDK 1.8
  • Maven 3.3.9

Exploded Project Structure Select All Download
  • boot-project-structure
    • src
      • main
        • java
          • com
            • logicbig
              • example

See Also