spring与struts2用过的注解

spring
@Repository用于标注数据访问组件,即DAO组件;
@Qualifier("userServiceImpl")   Spring会找到id为userServiceImpl的bean进行装配。
@Service("service")用于标注业务层组件 service别名
@Autowired 默认按类型装配(这个注解是属业spring的),默认情况下必须要求依赖对象必须存在,如果要允许null值,可以设置它的required属性为false,如:@Autowired(required=false)
如果我们想使用名称装配可以结合@Qualifier注解进行使用
@Transactional

struts
@Namespace("/html/hr")
public class xxxx{
}
@Action(value = "findAll", params = {},
            results = {@Result(name = "success", location = ""),
                    @Result(name = "error", location = "")})
public String xxx(){
}
/html/hr/findAll

@ParentPackage--父包注解相当于<package name="login" extends="struts-default"></package>中的extends属性,例如:@ParentPackage(value="struts-default")

猜你喜欢

转载自201609032307.iteye.com/blog/2377158