夜光序言:
在政客眼中,世上只有两种人,垫脚石和绊脚石。所有可能强过自己的人,都是潜在的威胁~
正文:
gradle配置文件的介绍 |
SLAM自主导航
我们选择auto-import自动导入
这样就可以从本地仓库导入jar包
/*下面这个是指定中央仓库,可以从中央仓库中进行下载~~
* mavenCentral表示中央仓库嗯*/
repositories {
mavenCentral()
}
/*gradle所有工程文件都在dependencies里面放置
*每一个jar包的坐标都有三个基本元素组成
* group、name、version这三个嗯
* testCompile只有在测试里面起作用嗯,说到底就是表示的作用域嗯
* 我们在grale里面添加坐标的时候都要带上jar包的作用域* */
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
附录:maven中央仓库
夜光:一步一步添加文件夹、类、接口
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
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="AccountDao" class="com.Genius.dao.impl.AccountDaoImpl"></bean>
</beans>
我们写一个测试类:
package com.Genius.test;
import com.Genius.dao.AccountDao;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class AccountTest {
@Test
public void accountTest() {
/*首先我们要得到spring容器*/
ApplicationContext as = new ClassPathXmlApplicationContext("bean.xml");
/*从容器中得到AccountDao对象*/
AccountDao accountDao = as.getBean(AccountDao.class);
/*接下来就是调用方法*/
accountDao.findAll();
}
}