What is the archetype to use to build a SpringBoot project? - spring-boot

For years, I've used Spring Initializr (at https://start.spring.io/) to create the initial SpringBoot application and then modify it to create the app. This works fine.
Is there a maven archetype I can use to create a SpringBoot app? Or is the Spring Initializr the only way to do this.
Searching I found this:
What archetype to choose for a simple java project
Which shows the command:
mvn archetype:generate -Dfilter=org.apache.maven.archetypes:
Which gives me a list of 14 items to choose from. None of them mention SpringBoot.
The closest match is org.apache.maven.archetypes:maven-archetype-webapp, so I tried it and it created a WebApp (*.war) which is not what I'm looking for.

The aim of the Maven archetype is for generating a project skeleton. The Spring Initialiser also does the same but I think you should find it more user friendly to use when compared to executing a maven archetype command.
If you insist to use maven archetype , you can simply search Github to see if there are people share their archetypes (search result at here)
If your aim is just to use command to generate a spring-boot project skeleton , Spring Initializr actually provide an HTTP API to do it.
Also you can checkout JHipster, which is another tool to generate a spring-boot project skeleton.

You could also use Spring Boot CLI to scaffold new Spring Boot projects:
spring init --dependencies=web,data-jpa my-new-project
It works just as Spring Initializr, but on the command line.
See section 2.4 "Initialize a New Project" on Spring Boot CLI documentation here: https://docs.spring.io/spring-boot/docs/current/reference/html/cli.html#cli.using-the-cli.initialize-new-project

Related

how to write a code for database connection from eclipse using spring. This should be a simple spring maven project without using spring boot

I am new to spring. I am not able to figure out how to write a spring project for creating DB connection using maven , without using spring -boot or hibernate. it is supposed to be a simple spring maven project.
can you help me with few sample codes.
Install the Spring tools suite plugin for eclipse from the following link.
With spring tools suite, access the spring dashboard
Select the Import Reference App, this will provide several example applications from the Spring guides, choose the example and the example will be installed onto your eclipse workspace. These examples are well documented , with clear instructions on how to run the project. Hopefully this should help you get started with learning Spring framework.

Spring Boot web app without maven

Friends,
I am trying to build a Spring boot project. but the challenge is maven isn't working in office environment(basically proxy isn't allowing).
Is there any way to create a spring boot project without maven?
if I can get any boiler code link would be very helpful.
Yes, it is possible. Just add all the necessary jar in project class path manually. Example Spring boot project jar added by gradle.
Part1
Part2

Spring Boot 1.2.4.RELEASE cannot generate a simple Startup Project

I am using Spring Boot version 1.2.4.RELEASE to generate a simple web project. The full Url for creating this project is:
http://start.spring.io/starter.zip?name=demo3&groupId=org.test&artifactId=demo3&version=0.0.1-SNAPSHOT&description=Demo+project+for+Spring+Boot&packageName=demo3&type=maven-project&packaging=jar&javaVersion=1.7&language=java&bootVersion=1.2.4.RELEASE&dependencies=web
The download starter project opened in the STS 3.6.4.RELEASE with tons of errors: Missing artifact, ArtifactDescriptorException from the pom.xml file.
However, if I use version 1.1.12.RELEASE of the Spring Boot, I have no problem to create the startup project.
Is this a bug in the 1.2.4.RELEASE of the Spring Boot? I doubt it.
The project is OK.
Please to check your local env, specially connexion, maven configuration (setting.xml), ...etc
Good luck

Maven 3 Archetype for Project With Spring, Spring MVC, Hibernate, JPA

I'm trying to use Maven 3 to create a project which uses Spring 3, Spring MVC, Hibernate 4, and JPA. However, when I execute:
mvn archetype:generate
Non of the archetypes listed include all of these; and even those which are close seem to be special projects such as projects with Flex. I want to avoid having extra modules such as Flex that would crowd the project and configuration files. So, is there an archetype for Maven 3 that I can use to create such a project?
A great Spring MVC quickstart archetype is available on GitHub, courtesy of kolorobot. Good instructions are provided on how to install it to your local Maven repo and use it to create a new Spring MVC project. He’s even helpfully included the Tomcat 7 Maven plugin in the archetypical project so that the newly created Spring MVC can be run from the command line without having to manually deploy it to an application server.
Kolorobot’s example application includes the following:
No-xml Spring MVC 3.2 web application for Servlet 3.0 environment
Apache Tiles with configuration in place,
Bootstrap
JPA 2.0 (Hibernate/HSQLDB)
JUnit/Mockito
Spring Security 3.1
Possible duplicate: Is there a maven 2 archetype for spring 3 MVC applications?
That said, I would encourage you to think about making your own archetype. The reason is, no matter what you end up getting from someone else's, you can do better in not that much time, and a decent sized Java project is going to end up making a lot of jar projects.
Take a look at http://start.spring.io/ it basically gives you a kick starter with either maven or gradle build.
Note: This is a Spring Boot based archetype.
With appFuse framework, you can create an Spring MVC archetype with jpa support, etc ...
Take a look at it's quickStart guide to see how to create an archetype based on this Framework.
Foundational frameworks in AppFuse:
Bootstrap and jQuery
Maven, Hibernate, Spring and Spring Security
Java 7, Annotations, JSP 2.1, Servlet 3.0
Web Frameworks: JSF, Struts 2, Spring MVC, Tapestry 5, Wicket
JPA Support
For example to create an appFuse light archetype :
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes
-DarchetypeArtifactId=appfuse-light-struts-archetype -DarchetypeVersion=2.2.1
-DgroupId=com.mycompany -DartifactId=myproject

Is there a maven 2 archetype for spring 3 MVC applications?

I'm experimenting with the spring 3 MVC framework. Since i use maven 2 to manage my project, i'm searching for a archetype to create a spring 3 MVC application.
You can use STS (spring tool suite) a new spring MVC template project creates a working application using spring 3.
Or you can using Spring Roo to give a working foundation to your project.
I also couldn't find useful archetypes, so I have created my own. You can find it here. If you find anything you'd like to add, please don't hesitate to mail me or send a patch
Spring MVC quickstart archetype is available on GitHub, courtesy of kolorobot. Good instructions are provided on how to install it to your local Maven repo and use it to create a new Spring MVC project. He’s even helpfully included the Tomcat 7 Maven plugin in the archetypical project so that the newly created Spring MVC can be run from the command line without having to manually deploy it to an application server.
Kolorobot’s example application includes the following:
No-xml Spring MVC 3.2 web application for Servlet 3.0 environment
Apache Tiles with configuration in place,
Bootstrap
JPA 2.0 (Hibernate/HSQLDB)
JUnit/Mockito
Spring Security 3.1
AppFuse and AppFuse Light have been upgraded to use Spring 3 so I guess you could use one of the appfuse archetypes.
But what is exactly a Spring MVC application if not a regular webapp with some dependencies on Spring 3 artefacts?
From the springsource forum:
In Spring Source Tool Suite.
Go to New -> Other -> Spring Source Tool Suite -> Spring Template Project -> Spring MVC Project
enter the details and click Finish.
The Codehaus Maven User Archetypes List has several archetypes including two from app-fuse that use Spring MVC.
This archetype creates a Java web application that uses Spring MVC framework, Angular and Event Sourcing.
mvn archetype:generate \
-DarchetypeGroupId=no.bouvet \
-DarchetypeArtifactId=maven-archetype-eventsourcing \
-DarchetypeVersion=1.0.2 \
-DgroupId=com.domain.myapp \
-DartifactId=myapp
You can find the source here - maven-archetype-eventsourcing
And read the blogg - Get your Event Sourced web application development started with one line using Maven!
A friend and I created this spring boiler plate for SPA applications. Could perhaps be useful to you https://github.com/PabloK/SpringRESTboilerplate
What I do is create a new Spring Project and one of the selections available in STS Simple Spring Web Maven; it sets up a Spring 3 Maven webapp, just modify the pom to Spring 4 and do a clean install from the Run Config.
As far as i know it does not exist. But why didn't create your own?

Resources