Spring - 基于注解创建bean
1. 介绍 之前我们写的bean都是基于xml配置,而这文章是基于java 注解去实现创建bean,首先我们需要在之前的xml当中添加两个dtd xmlns:context 和 xsi:schemaLocation <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" 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-4.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> </beans> 2.配置