springmvc 使用中遇到的问题

1、Name for argument type [java.lang.String] not available, and parameter name information not found in class file either

解决办法:http://jinnianshilongnian.iteye.com/blog/1705701

eclipse默认是debug级别的函数里面的参数名保留,但是ant编译就不行了。可以使用javac  debug=true

要不就是写全@RequestParam的参数

public String requestparam2(@RequestParam("username") String username)  

 

2、coutroller里面不能使用@Value

解决办法:项目使用了多个spring配置文件,然后properties需要多次引入,才可以使用。主要原因是扫描service类和controller不是一个spring配置文件

 

<context:property-placeholder location="classpath*:/Appkey.properties" />

 

      <bean id="placeholderConfig"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations">

<list>

<value>classpath*:/DataSourceConfig.properties</value>

<value>classpath*:/Appkey.properties</value>

</list>

</property>

</bean>

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值