首次开始想写点东西,打个目录序列,练习练习怎么玩,接下来再补;
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.html3、发布与部署:
给两个参考,需要注意的是:标红的地方,好多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; 我个人测试不通过
- @RunWith(SpringJUnit4ClassRunner.class)
- @SpringBootTest(classes = CldpApplication.class)
- @WebAppConfiguration
- public class GitHubControllerTest {
- @Autowired
- private GithubController controller;
- private MockMvc mvc;
- @Before
- public void setUp() throws Exception {
- mvc = MockMvcBuilders.standaloneSetup(controller).build();
- }
参考:mock测试spring boot的CRUD服务 http://blog.csdn.net/liuchuanhong1/article/details/53495004