目录
1.安装jdk配置环境的正确方式
2.在搭建maven项目所需要的依赖包(pom.xml)
3.Spring容器在实例化Bean时,可以创建以下作用域的Bean对象
1.安装jdk配置环境的正确方式
![](https://i-blog.csdnimg.cn/blog_migrate/148a206a74de79571bfae3460a3e8d89.png)
在系统下进行,因为它包含其他的路径,可以更方便,避免出现不必要的麻烦,这是本人经历过的......
变量名:JAVA_HOME 值:D:\java\jdk1.8.0_131 (版本是1.8,我的路径是在D盘,不过建议大家放在C盘,我的是由于硬盘没有空间)
变量名:CLASSPATH 值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar (请看清楚前面有个.)
变量名:MAVEN_HOME 值:D:\java\apache-maven-3.5.0(版本是3.5)(安装时候一定要配置到C盘)
变量名:path 值:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
2.在搭建maven项目所需要的依赖包(pom.xml)
<dependencies> <!-- 引入项目的依赖包 --> <!-- Springmvc Spring --> <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.3.7.RELEASE</version> </dependency> <!--spring jdbc--> https://mvnrepository.com/artifact/org.springframework/spring-jdbc <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.3.7.RELEASE</version> </dependency> <!--Spring面向切面--> https://mvnrepository.com/artifact/org.springframework/spring-aspects <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>4.3.7.RELEASE</version> </dependency> <--mybatis--> https://mvnrepository.com/artifact/org.mybatis/mybatis <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.4.2</version> </dependency> <!--MyBtis整合Spring的适配包--> https://mvnrepository.com/artifact/org.mybatis/mybatis-spring <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.3.1</version> </dependency> <--数据库,连接池 用到的是c3p0--> https://mvnrepository.com/artifact/c3p0/c3p0 <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <version>0.9.1.2</version> </dependency> <!--mysql的依赖包--> https://mvnrepository.com/artifact/mysql/mysql-connector-java <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.41</version> </dependency> <!--引入(jstl,servlet-api,junit)--> https://mvnrepository.com/artifact/jstl/jstl <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <!--servlet-api--> https://mvnrepository.com/artifact/javax.servlet/servlet-api <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <!--junit测试--> https://mvnrepository.com/artifact/junit/junit <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> |
3.Spring容器在实例化Bean时,可以创建以下作用域的Bean对象
![](https://i-blog.csdnimg.cn/blog_migrate/eabc5f624a33ac5dbe974312167ba698.png)