上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 在Java编程中,特别是在使用MyBatis或MyBatis-Plus这样的ORM(对象关系映射)框架时,@Mapper是一个常见的注解,用于标记接口为MyBatis的Mapper接口。Mapper接口是MyBatis中用于操作数据库的核心接口,它定义了与数据库表交互的方法。 下面我将简要介绍@Ma 阅读全文
posted @ 2024-07-24 07:46 文采杰出 阅读(1376) 评论(0) 推荐(0)
摘要: 当你看到@SpringBootTest注解以及其中的@BootstrapWith和@ExtendWith元注解时,这是与Spring Boot和JUnit 5集成相关的内容。解释如下: @SpringBootTest @SpringBootTest是Spring Boot提供的一个注解,用于加载Sp 阅读全文
posted @ 2024-07-24 00:23 文采杰出 阅读(75) 评论(0) 推荐(0)
摘要: @SpringBootApplication 和 @SpringBootConfiguration 是 Spring Boot 框架中用于简化配置的两个重要注解。它们之间的关系和各自的作用如下: @SpringBootConfiguration @SpringBootConfiguration 注解 阅读全文
posted @ 2024-07-24 00:22 文采杰出 阅读(206) 评论(0) 推荐(0)
摘要: 首先编写相当于web.xml的配置类 package com.powernode.springmvc.config; import jakarta.servlet.Filter; import org.springframework.context.annotation.Configuration; 阅读全文
posted @ 2024-07-19 10:02 文采杰出 阅读(21) 评论(0) 推荐(0)
摘要: 在Spring MVC中,public interface View 和 public interface ViewResolver 是两个相互关联但功能不同的接口。它们共同在视图解析和渲染过程中发挥作用,但各自承担的责任不同。 View 接口 View 接口定义了如何渲染一个特定的视图。它通常包含 阅读全文
posted @ 2024-07-18 08:47 文采杰出 阅读(29) 评论(0) 推荐(0)
摘要: Spring MVC在处理器方法执行过程中出现了异常,可以采用异常处理器进行应对。 一句话概括异常处理器作用:处理器方法执行过程中出现了异常,跳转到对应的视图,在视图上展示友好信息。 配置ExceptionController package com.powernode.springmvc.cont 阅读全文
posted @ 2024-07-13 23:08 文采杰出 阅读(18) 评论(0) 推荐(0)
摘要: 使用SpringMVC6版本,不需要添加以下依赖: <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.5</version> </depe 阅读全文
posted @ 2024-07-12 23:53 文采杰出 阅读(270) 评论(0) 推荐(0)
摘要: mvc:annotation-driven/ 是 Spring MVC 中的一个配置元素,它用于简化和加速 Spring MVC 应用的配置,尤其是那些使用注解的控制器。当你在 Spring MVC 配置文件中添加了 mvc:annotation-driven/ 元素时,Spring 会自动注册一系 阅读全文
posted @ 2024-07-08 10:20 文采杰出 阅读(278) 评论(0) 推荐(0)
摘要: Tomcat, Jetty 等)默认的 Servlet,以便能够处理静态资源请求,如 HTML 文件、图片、CSS 文件、JavaScript 文件等。在 Spring MVC 的上下文中,静态资源默认会被当作请求映射处理,这可能会导致静态资源无法正确加载。使用 mvc:default-servle 阅读全文
posted @ 2024-07-08 10:14 文采杰出 阅读(223) 评论(0) 推荐(0)
摘要: 配置IndexController package com.powernode.springmvc.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.an 阅读全文
posted @ 2024-07-08 00:59 文采杰出 阅读(13) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 10 下一页