随笔分类 -  Java

摘要:If you were using Microservice with Spring Boot to build different REST API endpoints, context path might help you. For example, you have two endpoint 阅读全文
posted @ 2019-06-06 13:53 Zhentiw 阅读(224) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-05-19 04:00 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure. The key 阅读全文
posted @ 2019-05-14 23:27 Zhentiw 阅读(266) 评论(0) 推荐(0) 编辑
摘要:Previously we use Application Context to get Bean and Dependenies injection. It is actually easier to use 'CommonLineRunner'. Main beneift is we can u 阅读全文
posted @ 2019-05-14 23:15 Zhentiw 阅读(787) 评论(0) 推荐(0) 编辑
摘要:It is recommened to write unit testing with Mockito in Spring framework, because it is much faster with Spring framework test. But in case you can doi 阅读全文
posted @ 2019-04-24 15:43 Zhentiw 阅读(211) 评论(0) 推荐(0) 编辑
摘要:For example, we want to test against a implemataion: We want to do the test with Java Context: 1. Bring in some dependencies: in pom.xml Create a new 阅读全文
posted @ 2019-04-24 15:14 Zhentiw 阅读(394) 评论(0) 推荐(0) 编辑
摘要:In this post, we are going to see more functionalities in Mockito. Mock a List interface: Call multi times: First call, return 10, second times return 阅读全文
posted @ 2019-04-23 20:25 Zhentiw 阅读(834) 评论(0) 推荐(0) 编辑
摘要:Previously we have seen how to do Unit testing with Mockito; In this post, we are going to see, using annotation from Mockito to make testing easier: 阅读全文
posted @ 2019-04-18 20:23 Zhentiw 阅读(302) 评论(0) 推荐(0) 编辑
摘要:We have the implemetion: And we want to test agaisnst it: 阅读全文
posted @ 2019-04-17 17:52 Zhentiw 阅读(175) 评论(0) 推荐(0) 编辑
摘要:Check the get started guid https://junit.org/junit5/docs/current/user-guide/#overview-getting-help 阅读全文
posted @ 2019-04-16 17:44 Zhentiw 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Let's say we have a extral app.proporites file which contains some extra configuration: We can read the extra propoties by using @Value("${xxx}") As y 阅读全文
posted @ 2019-04-12 19:35 Zhentiw 阅读(303) 评论(0) 推荐(0) 编辑
摘要:Component Scan is important concept when we want to create Bean. Currently we know what, for the class, we want to create Bean from it, we need to add 阅读全文
posted @ 2019-04-09 18:38 Zhentiw 阅读(201) 评论(0) 推荐(0) 编辑
摘要:We have the following example: The idea is to understand in different cases, how those instanse are created. Currently when running the application, w 阅读全文
posted @ 2019-04-05 15:53 Zhentiw 阅读(440) 评论(0) 推荐(0) 编辑
摘要:When we use Bean to do autowired, it actually use singleton, so even we create multi instanses, they are the same: It print out: We can also tell Spri 阅读全文
posted @ 2019-04-05 15:23 Zhentiw 阅读(459) 评论(0) 推荐(0) 编辑
摘要:In the example we have currently: The way we do Autowired is by '@Primary' decorator. It is clear that one implementation detail is the best, then we 阅读全文
posted @ 2019-04-04 18:28 Zhentiw 阅读(764) 评论(0) 推荐(0) 编辑
摘要:Spring boot is really good for Dependencies injection by using Autowiring. Each class instancse in spring boot is called 'Bean', we can use 'Bean' to 阅读全文
posted @ 2019-04-03 18:45 Zhentiw 阅读(651) 评论(0) 推荐(0) 编辑
摘要:JPA is just like a helper class for providing data for Controller, has method like 'findOne', 'findAll', 'saveAndFlush', 'delete'. in repository/Shipw 阅读全文
posted @ 2019-01-16 20:53 Zhentiw 阅读(417) 评论(0) 推荐(0) 编辑
摘要:We need our data persistence with configuring our datasouce: In application.properties: " " tells to save the in memory data into a file called 'gs-sp 阅读全文
posted @ 2019-01-14 21:55 Zhentiw 阅读(203) 评论(0) 推荐(0) 编辑
摘要:In pom.xml add dependency: Then in application.properties: Now, in the broswer, we can access h2 database though url: localhost:8080/h2 阅读全文
posted @ 2019-01-14 21:44 Zhentiw 阅读(179) 评论(0) 推荐(0) 编辑
摘要:We can use different application properties application.properties: application-prod.properties: application-test.properties: We can setup different p 阅读全文
posted @ 2019-01-14 21:30 Zhentiw 阅读(127) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示