miércoles, 4 de julio de 2018

Create a new project by using Spring Initializr

Create a new project by using Spring Initializr

1.       Go to the page of Spring Initializr. https://start.spring.io/
2.       Choose as many dependecies as you need in your project. In my case I chose web, JPA and DevTools.
3.       Type the group you want your project have
4.       Type the artifact you want your project have
5.       Generate the project and save it.
See the image
 

6.       Unzip the project that you downloaded in the previous step.
7.       Open your IDE, in my case I used Eclipse Oxygen
8.       In File -> Import, search maven and choose Existing maven options
See the image


9.       Click next
10.   Click in Browse, search your unzipped project and select it.
11.   Pom.xml file is selected by default, just click on finish.
12.   Your project will see you in the project explorer with a M
See the image.

 

13.   Run your project as a Java application by executing the class that is located in src/main/java in the package that have the name of the domain that you typed in Spring Initializr.
14.   If you are using JPA dependency you need to add the Enabled configuration like the image below. The application won’t run without it unless you specify a data source or database connection.
15.   If you are using spring security you need to add 
management.security.enabled=false in your application.propperties file like the image below. Application.propperties is in src/main/resource package.


16.   Create a simple HTML file in src/main/resource/static called index.html
See the image

17.   Open a browser and type localhost:8080, by default the port of Spring is 8080. You would get your simple HTML
18.   You might have some problems is you install the Oracle database 11g because there are a service running on port 8080 you can change the port of Spring by adding server.port=8090 to your application.propperties file



Thanks for reading

No hay comentarios:

Publicar un comentario