I had the opportunity to use Spring boot for business, and I was scared to see many things that I couldn't find in ordinary Java, such as @Autowired
and @ RestController
, so I looked it up.
Since the main is the front end, I don't know much about Spring. ~~ (I don't even know the front end) ~~
Please do not hesitate to point out any mistakes. .. ..
There is a ** MVC model **. Please see here for details on this article.
view→controller→service→repository→template
It was a story that it has a structure like that.
@ RestController
?Annotation attached to the controller. There is a similar one, @Controller
, but the return value is different.
RestController is used by the controller for webApi, so what is returned is the content. (Json?)
It seems that the return value of the Controller is the transition destination as it is.
(I don't see this in business because vue carries all the views on his back and uses a lot of apis.)
@Autowired
?With this, the corresponding component will be brought from the component with @Component
.
Moreover, it is new and instantiated. .. good boy. .. ..
A brief description of Spring DI and AOP Various return values in Spring MVC controller
Recommended Posts