Day01 Spring起步

一、后端开发的概念和技术栈

1.1 什么是后端开发?

https://zhuanlan.zhihu.com/p/27067255

1.2 java后端技术图谱

技术图谱

二、javaEE概念

Java EE,Java 平台企业版(Java Platform Enterprise Edition),之前称为Java 2 Platform, Enterprise Edition (J2EE),2018年3月更名为 Jakarta EE(这个名称应该还没有得到群众认可)。是 Sun 公司为企业级应用推出的标准平台,用来开发B/S架构软件。Java EE 可以说是一个框架,也可以说是一种规范。

三、JavaWeb需要掌握什么?

  • 网络通信协议:http
  • 服务器:tomcat(开源),jetty(嵌入式),weblogic(商用),ngix(静态),apache(静态)
  • 云服务器:阿里云、腾讯云
  • servlet,过滤器,监听器
  • 其他:缓存、日志、git、maven、跨域、负载均衡

四、Spring框架特点及构成

4.1 Spring化繁为简主要的表现为以下几个方面。

  • 轻量级IoC容器。
  • 采用AOP编程方式。
  • 大量使用批注。
  • 避免重复“造轮子”,减少代码的重复性。

4.2 构成

  • Spring Core:核心容器,BeanFactory提供了组件生命周期的管理,组件的创建,装配,销毁等功能
  • SpringContext:ApplicationContext,扩展核心容器,提供事件处理、国际化等功能。它提供了一些企业级服务的功能,提供了JNDI,EJB,RMI的支持。
  • Spring AOP:提供切面支持
  • Spring DAO:提供事务支持,JDBC,DAO支持
  • Spring ORM:对流行的O/R Mapping封装或支持
  • Spring Web:提供Web应用上下文,对Web开发提供功能上的支持,如请求,表单,异常等。
  • Spring Web MVC:全功能MVC框架,作用等同于Struts。

Spring的起步练习步骤

  • 下载maven
  • 如何使用idea配置maven
  • 新建项目helloworld(注意项目名字不要大写)
  • 添加依赖包



org.springframework
spring-context
5.0.10.RELEASE

  • 新建helloworld类

public class helloworld {
public String getHello(){
return "hello world";
}
}

  • 配置beans.xml

  • 编写helloworldApp

public static void main(String[] args) {
// 读入xml文件
ApplicationContext context=new ClassPathXmlApplicationContext("/beans.xml");
// 读取配置好的bean
helloworld helloworld= (com.soft1721.spring.hello.helloworld) context.getBean("helloworld");
// 运行helloworld方法
System.out.println(helloworld.getHello());
}

  • 传入参数










constructor-arg用于数据类型不是一般数据类型时,property用于一般数据类型适用范围较广

你可能感兴趣的:(Day01 Spring起步)