
spring
jackyxwr
这个作者很懒,什么都没留下…
展开
-
No mapping found for HTTP request with URI [/chapter2/loginCheck] in Dispatc
首先在spring-mvc.xml文件 中配置 扫描类包<context:component-scan base-package="com.smart.service"/>然后jsp代码如下<form action="<c:url value="/loginCheck"/>" method="post"> 用户名:<inpu原创 2018-05-10 22:11:55 · 1902 阅读 · 0 评论 -
解析@EnableWebMvc 、WebMvcConfigurationSupport和WebMvcConfigurationAdapter
在spring-boot+spring mvc 的项目中,有些时候我们需要自己配置一些项目的设置,就会涉及到这三个,那么,他们之间有什么关系呢?首先,@EnableWebMvc=WebMvcConfigurationSupport,使用了@EnableWebMvc注解等于扩展了WebMvcConfigurationSupport但是没有重写任何方法,所以有以下几种使用方式:@EnableW转载 2017-10-18 16:31:14 · 2715 阅读 · 0 评论 -
spring注解
一、@EnableAutoConfiguration这个注释告诉SpringBoot“猜”你将如何想配置Spring,基于你已经添加jar依赖项。如果spring-boot-starter-web已经添加Tomcat和Spring MVC,这个注释自动将假设您正在开发一个web应用程序并添加相应的spring设置。 自动配置被设计用来和“Starters”一起更好的工作,但这转载 2017-10-18 15:34:56 · 289 阅读 · 0 评论 -
在spring中使用JDBC事务配置
1:首先在applicationContext.xml文件中配置如下信息2:在dao层的代码片断如下@Resourceprivate JdbcTemplate jdbcTemplate;public void addBatch(final List ts){final List tts = ts;try {String sql = "insert int原创 2016-09-05 15:35:34 · 446 阅读 · 0 评论 -
springmvc结构中 没有异常,但无法调到controler层
近日,在做开发时,发现无法调用Controller层的方法,最终经过摸索,发现其原因是由于在Controller层中,方法中的参数使用的是基本类型,比如说整数类型使用了int,而不是Integer。当使用int时,如果在界面对此参数没有传参,则直接报错。原创 2015-06-10 15:53:41 · 1763 阅读 · 0 评论 -
http中post提交的两种格式
http中post提交的中有一个关键属性:enctype,其值有两种:application/x-www-form-urlencoded和multipart/form-data。对于application/x-www-form-urlencoded这种形式,它是与表单的形式进行上送的。这个可以直接通过request.getParameter进行获取。而对multipart/form-data,这个原创 2015-06-05 10:20:06 · 1115 阅读 · 0 评论 -
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current 出错
org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessioorg.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current threadnContext.java:1原创 2015-05-14 16:18:16 · 7147 阅读 · 1 评论 -
spring与junit结合测试
对于Spring与Junit的测试,首先要在类的头部引入如下两个注解@RunWith(SpringJUnit4ClassRunner.class)//基于JUnit4的Spring测试框架@ContextConfiguration(location={"classpath:applicationContext.xml", "classpath:spring-mvc.xml"}//启动Spr原创 2014-12-04 10:38:05 · 1526 阅读 · 0 评论 -
Spring @autowire用法
在传统的spring注入方式中,我们对类变量都要求实现get与set的方法。在pring 2.5 引入了 @Autowired 注释,它可以对类成员变量、方法及构造函数进行标注,完成自动装配的工作。 通过 @Autowired的使用来消除 set ,get方法。不过在引及@Autowired注释后,要在spring的配置文件 applicationContext.xml中加入:如下代码,原创 2014-12-04 10:13:13 · 11091 阅读 · 0 评论 -
spring过滤器总结
1:OpenSessionInViewFilter 此过滤器使用在hibernate与spring结合的原创 2014-10-31 16:45:03 · 3305 阅读 · 0 评论 -
Spring总结
1:接口以小接口为好,这样扩展、复用、修改都比较容易2:对于依赖关系无须变化的注入,采用构造注入,其它的都采用设值注入 3:对于多个属性的配置文件,应采用ApplicationContext来创建BeanFactory的实例 4:项目中的多个applicationContext.xml文件是如何被加载到项目中的这个是在web.xml中的进行配置,然后被加载。可以这么考虑这个问题原创 2014-03-22 11:54:07 · 595 阅读 · 0 评论