0
  1. I installed Eclipse IDE for Enterprise Java Developers.
  2. I went to menu Help -> Eclipse Marketplace... and installed "Spring Tools 4 (aka Spring Tools Suite 4)"

My goal is to create a first simple Spring MVC application. So I went to youtube and found a tutorial video. In the video it's proposed to perform the steps New -> Other... -> Spring and the following list should appear:

  • Import Spring Getting Started Content
  • Spring Bean Configuration File
  • Spring Bean Definition
  • Spring Project
  • Spring Roo Project
  • Spring Starter Project
  • Spring Web Flow Definition File

It's proposed to choose "Spring Project". But I have only two items from that list:

  • Import Spring Getting Started Content
  • Spring Starter Project

Did I installed anything incorrectly? What am I supposed to choose to create a Spring MVC project (and what options)?

Daniel
  • 295
  • 2
  • 9

3 Answers3

1

You can create a Dynamic web project and cpnvert that to maven project if you want or can add dependencies in the classpath yourself as jars.

Otherwise You can create a maven project and add files like web.xml and spring-mvc-servlet.xml yourself.

You can use this tutorial for use as this will give you some ideas how to start a spring mvc project in eclipse. https://crunchify.com/simplest-spring-mvc-hello-world-example-tutorial-spring-model-view-controller-tips/

Sanket Singh
  • 1,246
  • 1
  • 9
  • 26
  • Thank you for your suggestions and the link! But they don't look like a convenient way to create an empty Spring MVC project, do they? As I understand, the Spring Tools plugin should add Sping projects templates for creating Spring projects in a couple of clicks. For example, I saw a Spring MVC Project template in tutorial videos. – Daniel Jul 04 '20 at 15:13
  • I don't think there's any preferred way to create a project. I can tell mine we obviously create a project by using Dynamic Web Project things because it provides us the basic structure and let us control all the other required thing however if you want a sample structure created already you can use archtypes in maven projects like https://www.codejava.net/frameworks/spring/creating-a-spring-mvc-project-using-maven-and-eclipse-in-one-minute – Sanket Singh Jul 04 '20 at 15:19
1

I also had trouble with STS 4 and later on I installed 3.9 and it worked just fine. I recommend you downloading STS if you want to build spring / spring boot projects [ not compulsory though ] .

You can see spring legacy project for spring MVC option and it generates a good project structure which comes with ready to run code and standard project structure. Hope this helps.

Badri Paudel
  • 1,365
  • 18
  • 19
  • Thank you. Download STS - you mean STS 3.9 or what? – Daniel Jul 04 '20 at 15:16
  • And why spring mvc option is a legacy project? Is spring mvc becoming deprecated or not very popular? – Daniel Jul 04 '20 at 15:18
  • Yes , download STS 3.9 [3.9.1] . You might see other options for spring for eg spring project / spring legacy project. For spring MVC , if you don't want to create spring boot I think it's still popular. Especially REST APIs are becoming popular nowadays and for that spring boot with spring data jpa is so popular. Depends on what you want to create. – Badri Paudel Jul 04 '20 at 15:30
0

The list of options to create a project that you mentioned from the video is the list of options that you get when using the old Spring Tool Suite 3.

The new Spring Tools 4 for Eclipse have a reduced set of options to create Spring projects and is focused on Spring Boot based projects. In case you start with Spring nowadays, I would strongly recommend to start using Spring Boot and to get started with a Spring Boot project using one of those two options to create a Spring Boot project that comes with the Spring Tools 4.

The old wizards from the Spring Tool Suite 3 (including the Spring MVC project that you could create from it) is not based on Spring Boot and not what I would recommend to start with.

Martin Lippert
  • 5,988
  • 1
  • 15
  • 18
  • Thanks a lot! Could you explan the difference between an old Spring MVC Project and a new Spring Boot project? Why should I use the latter? – Daniel Jul 05 '20 at 15:13
  • The 'legacy' spring mvc projects that STS 3 creates use very old version of Spring that dates back from befor Spring Boot. Spring Boot is a layer on top of Spring that avoids a lot of boilerplate configuration by providing good default 'autoconfiguration'. As such, spring boot is much easier to get started with and quickly create a small toy application. With a 'plain' spring project that would instead require a lot more 'scaffolding' to configure beans that make the application work. For a spring mvc with boot, tutorial, have a look at this: https://spring.io/guides/gs/serving-web-content/ – Kris Jul 06 '20 at 15:11