jugLviv

Meta


Share on:


#ProjectFromScratch: SpringBoot – Part2

JUG LvivJUG Lviv

Hence I decided to create web application then there are two good options for quick start  SpringBoot or Spark

Spark is much simpler but SpringBoot brings Spring – I would say Spring is musthave framework nowdays so that my choice is SpringBoot. 
Following GettingStarted doc I’m creating two classes in web module: config called Application.java and our hello world controller HelloController.java
Usually I create package config for configs and package controller for controllers.
Except created classes we need add required SpringBoot dependency
Add to parent pom dependency management section in following way
 
<properties>
<spring.boot-version>1.2.3.RELEASE</spring.boot-version>
</properties>

<dependencymanagement>
<dependencies>
<dependency>
<groupid>org.springframework.boot</groupid>
<artifactid>spring-boot-starter-web</artifactid>
<version>${spring.boot-version}</version>
</dependency>
</dependencies>
</dependencymanagement>

and add to pom.xml in web module dependency itself

 
<dependencies>
<dependency>
<groupid>org.springframework.boot</groupid>
<artifactid>spring-boot-starter-web</artifactid>
</dependency>
</dependencies>

Now you can check if source is compilable with command mvn clean compile and run main on Application.java When you run main, embedded tomcat will start and listen port 8080. Check it with calling url http://localhost:8080

JUG Lviv
Author