也谈Spring boot + mybatis

首次开始想写点东西,打个目录序列,练习练习怎么玩,接下来再补;

1、开发环境的选择 intellij idea,这个没有什么好说的,个人习惯,要是喜欢用eclipse也一样。个人是也做android,用adroid studio,顺手把eclipse也改成intellij idea


2、 hello world

SpringBoot入门系列:第二篇 再学Hello World http://blog.csdn.net/lxhjh/article/details/51751847


mybatis入门基础(二)----原始dao的开发和mapper代理开发

http://www.cnblogs.com/selene/p/4605191.html

3、发布与部署:

给两个参考,需要注意的是:标红的地方,好多blog写的是Application(因为别人的默认类就是这个),这个你要自动添加引用,也能编过,但就是发布不成功

public class SpringmapperApplication extends SpringBootServletInitializer {

    @Override
   protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
      return application.sources(SpringmapperApplication.class);
   }

   public static void main(String[] args) throws Exception {
      SpringApplication.run(SpringmapperApplication.class, args);
   }

}

spring boot 部署到tomcat :http://www.cnblogs.com/leohe/p/6646140.html

spring-boot项目在外部tomcat环境下部署: http://blog.csdn.net/james_wade63/article/details/51009423


4、测试

需要注意的是 1、@SpringBootTest 这行 springboot 1.4以上版本可以注提了没有定义

                       2、controller的引用 有的人写  WebApplicationContext webApplicationConnect;  我个人测试不通过

  1. @RunWith(SpringJUnit4ClassRunner.class)  
  2. @SpringBootTest(classes = CldpApplication.class)  
  3. @WebAppConfiguration  
  4. public class GitHubControllerTest {  
  5.     @Autowired  
  6.     private GithubController controller;  
  7.   
  8.     private MockMvc mvc;  
  9.   
  10.     @Before  
  11.     public void setUp() throws Exception {  
  12.         mvc = MockMvcBuilders.standaloneSetup(controller).build();  
  13.     }  


参考:mock测试spring boot的CRUD服务 http://blog.csdn.net/liuchuanhong1/article/details/53495004




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值