刚学注解,遇到问题,求解释
strut2的action里面:
service里面:
dao里面:
basedao:
application.xml里面
action里面的那个iAcctUserService总是为空
@Namespace("/acctuser")
@Results( { @Result(name = CrudActionSupport.OK, location = "acctuser",type="chain") })
@Component("acctuser")
@Scope("prototype")
@SuppressWarnings("serial")
public class AcctuserAction extends CrudActionSupport<AcctUser> {
@Autowired
private IAcctUserService iAcctUserService;
service里面:
@Service("iAcctUserService")
@Transactional
public class AcctUserService implements IAcctUserService{
@Autowired
private IAcctUserDao iAcctUserDao;
dao里面:
@Repository("iAcctUserDao")
public class AcctUserDao extends BaseDao implements IAcctUserDao{
public boolean login(String uname, String upass) {
String sql = "select count(*) from acct_user where login_name='"
+ uname + "' and password='" + upass + "'";
int count=jdbcTemplate.queryForInt(sql);
if(count>0){
return true;
}
return false;
}
basedao:
public class BaseDao {
@Autowired
public JdbcTemplate jdbcTemplate;
application.xml里面
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<value>classpath*:/util.properties</value>
</list>
</property>
</bean>
<!-- 使用annotation 自动注册bean,并保证@Required,@Autowired的属性被注入 -->
<context:component-scan base-package="com.jw" />
<!-- 数据源配置,使用应用内的DBCP数据库连接池 -->
<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${mysql.driver}" />
<property name="url" value="${mysql.url}" />
<property name="username" value="${mysql.username}" />
<property name="password" value="${mysql.password}"></property>
</bean>
<!-- 使用annotation定义事务 -->
<tx:annotation-driven proxy-target-class="true" />
<bean name="jdbcTemplet" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
action里面的那个iAcctUserService总是为空
...全文
相关推荐
java中主键id的注解解释
本文档简述了有关javabean中id的注解解释,注解本来就很繁琐,但是学好的话用起来还是比较方便的
自定义注解和注解解释器
自定义注解,与注解解释器,并且实例化使用注解的类
Spring @Value注解失效问题解决方案
主要介绍了Spring @Value注解失效问题解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
注解,注解的示例以及解释说明,能让大家更好的了解注解的使用方式
注解的使用,注解的示例以及解释说明,能让大家更好的了解注解的使用方式
关于Spring注解@Async引发其他注解失效的解决
主要介绍了关于Spring注解@Async引发其他注解失效的解决,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧



