1.是首字母小写 比如 UserAction对应的id是userAction
可以通过
ApplicationContext 对象的act.getBean("userAction");获取
注入是
2.如果多个实现类(一个写不写无所谓)
@Resource(name = "userServiceImpl1")
private UserService service;
这样的形式指定你要的实现类,name为spring中bean的id
关于spring的注解方式注入默认值(转) -- 首字母小写
![](https://img2024.cnblogs.com/blog/35695/202405/35695-20240529225347158-1507288531.jpg)
1.是首字母小写 比如 UserAction对应的id是userAction
可以通过
ApplicationContext 对象的act.getBean("userAction");获取
注入是
2.如果多个实现类(一个写不写无所谓)
@Resource(name = "userServiceImpl1")
private UserService service;
这样的形式指定你要的实现类,name为spring中bean的id