Spring 3 Annotations

I can't get spring annotations to work at all, I'm just trying to get the simplest thing to work ...

... / mycontext / something β†’ calls the method:

@RequestMapping(value = "/something") @ResponseBody public String helloWorld() { System.out.println("hello world"); return "Hello World"; } 

My main problem is, as far as I try, I can’t find a complete simple example of the necessary configuration files, each spring tutorial is filled with junk, I’m just one controller to process the request using display and cannot make it work

Does anyone know a simple and complete spring example. The PET clinic is not good, it's too complicated, I have a tiny base use case, and it becomes a real pain to work (this always happens with Spring)

+4
source share
4 answers

You should try Spring Roo . It will generate a simple Spring application for you using simple commands, and then you can gradually expand it. This is a great tool for learning Spring, as well as for rapid application development.

You can also find some examples of the Spring 3.0 MVC framework .

+5
source

The absolute easiest alternative, if you are familiar with Eclipse, is to use the SpringSource Tool Suite (Eclipse plugins)

This product has a built-in tcServer.

By default, STS will start from the dashboard page in the editor window. From here you can click on the creation of the controller, as shown in this screenshot:

alt text

This is a fairly simple controller, and all you need to do to deploy it to the connected tcServer (Tomcat with some additional management features) is to click "next" several times in the wizard.

This is a very good starting point for your own testing!

+4
source

I would recommend you check out some of the projects from here.

and try to enter the spring book in action (picking), they give a very good example of how to use aspects

or refer to this question

0
source

I endorse this blog post, Layered Architecture with Hibernate and Spring . This was a big help for me when I tried to switch from the declared xml approach to annotations. It contains the use of annotations in the Entity, Dao, and Service layers.

0
source

Source: https://habr.com/ru/post/1311013/


All Articles