spring 学习基础jar包

spring 学习

最近在学习spring框架,感觉到了sping框架在开发中的方便性,就用博客来当笔记吧。

首先要去spring官网下载jar包

[spring官网链接](https://spring.io/
[spring相关 jar包下载教程链接] (https://jingyan.baidu.com/article/455a99505b399da16627783b.html)

然后还有些spring jar包中没有的东西,这时就要去maven下载。在maven官网搜索需要的jar包然后把代码复制到maven项目的pom.xml配置文件里面,然后maven项目就会帮你下载到本地maven库中,spring项目要用直接去maven库复制就行了

jar包导入

第一天,学了ioc(控制反转)DI(依赖注入)需要的jar包不多只有五个,四个核心,一个依赖
效果是这样的1488305-20190717215136707-1636439890.jpg

然后就可以开始写配置文件了
配置文件一般命名为applicationContext.xml
bean的装配基于注解的配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans  
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context.xsd">
       <!-- schema命名空间
       1.命名空间声明
        默认:xmlns="" <标签名>
        显示:xmlns:别名=""  <别名:标签名> -》<context:...>
       2.确定schema xsd位置
        xsi:schemaLocation="名称  位置 名称2 位置2" 
        -->                    
       
   <!-- 创建Service实例 -->   
   <!--            
<bean id="userService" class="com.itheima.spring_annotation.a_ioc.UserServiceimpl"></bean>
--> 
    <!-- 组件扫描, 扫描含有注解的类 -->
    <context:component-scan base-package="com.itheima.spring_annotation.a_ioc"></context:component-scan> 
</beans>

转载于:https://www.cnblogs.com/a1737301376/p/11203807.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值