Monday, 5 February 2018

How to create a Springboot applicaiton ?




1. Open eclipse Neon
3. Generate a "Maven project" with "Java" and Spring boot 1.5.10
    (By default stable version will be selected)
4. Click "Switch to the full version" for more config
5. Provide group = com.portal | artifact = core | Name = Portal Core | Desc =Base framework for Springboot app  | Packaging = JAR | Java version = 8
6. Click Generate

It will give you a zip to download.

7. Save the zip and extract

8. Put folder in workspace (C:\java-developper-softwares\gitrepo\portal -> core)

9. In eclipse, Import > Maven > Existing Maven project

10. Choose root dir = C:\java-developper-softwares\gitrepo\portal\core
       POM must be auto selected.
11. Finish

12. Change in pom.xml according to requirement, and save. It will update all the dependencies.
spring-boot-starter : To run Spring as an standalone application.
spring-boot-starter-web : Also required to run Spring as a Web application or API.

It gives the below class :
@SpringBootApplication
public class TrainingApplication {
    public static void main(String[] args) {
       ApplicationContext ctx = SpringApplication.run(TrainingApplication.class, args);

    }
}


You can write your code in main method.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.