转载声明:文章来源https://blog.csdn.net/qq_38066923/article/details/83317878
Spring概念
1.Spring 是一个开源框架
2.Spring 是为了简化企业级应用开发而生,使用Spring 可以简单的3.3.JavaBean 实现只EJB才能开发的功能
4.Spring 是java/javaee 一站式框架
## spring优点
1.放便解耦,简单开发
2.Aop 编程支持
3声明事务的支持
4.方便程序的测试
5.方便框架的集合
6.降低开发难度
Spring ioc 的基本开发入门
1.创建接口
package com.imooc;
public interface imp {
public void Demo();
}
2.创建实现类
package com.imooc;
public class SpringDemo1 implements imp {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void Demo() {
System.out.println("hello" +name);
}
}
3.导入Spring 所需包
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.imooc.springioc</groupId>
<artifactId>springioc</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
</dependencies>
</project>
4.配置spring 配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="text" class="com.imooc.SpringDemo1">
<!--设置依赖注入-->
<property name="name" value="张三"></property>
</bean>
</beans>
5.创建测试类
package com.imooc;
public class SpringDemo1 implements imp {
public void Demo() {
System.out.println("hello"+name);
}
}
6. 实现结果
我想问一下前端面试的时候可以自选语言嘛?平常刷题都是用的java语言…
学习学习学习
有没有大佬带带小白