注解开发:
引入context
@AutoWired
@Resource
使用的时候
@Component
public class User{
@Value(“kuangsehn”)
public String setName(String name){
this.name = name’
}
}
@Controller
@Service
@Repository
的作用就是将某个类注册到Spring容器中 然后装配
用注解 注意前提条件:让注解生效 就要开启注解的前提条件