Câu hỏi phỏng vấn Spring
Câu hỏi

Do you need spring-mvc.jar in your classpath or is it part of spring-core?

Câu trả lời

To answer the interview question: No, the spring-mvc.jar is not part of spring-core. You do need to explicitly include spring-mvc.jar in your classpath if you are developing a Spring MVC application.

Spring Core and Spring MVC serve different purposes within the Spring Framework. Spring Core provides the fundamental functionalities of the Spring Framework, primarily through its Dependency Injection (DI) container. It manages the creation and lifecycle of Spring beans and is essential for almost all applications built with Spring.

On the other hand, Spring MVC is a framework designed specifically for building web applications. It operates on top of the Spring Core and utilizes the DI features provided by the Core to support the web application architecture. This separation allows developers to use Spring Core without necessarily using Spring MVC if they are not building a web application[1].

Therefore, if your project is a web application using Spring MVC, you must include spring-mvc.jar or its equivalent dependency in your project setup. This is typically handled through build automation tools like Maven or Gradle, which manage dependencies more efficiently. For instance, using Maven, you would include a dependency on spring-webmvc in your pom.xml file, which transitively includes all required components for Spring MVC[1][3].

In summary, `spring-mv...

junior

junior

Gợi ý câu hỏi phỏng vấn

expert

What is the difference between @Inject and @Autowired in Spring Framework? Which one to use
under what condition?

senior

What is Weaving in Spring?

senior

What are some of the important Spring annotations you have used?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào