随笔分类 -  Java

摘要:Controller: Code below shows a basic Controller to handle GET, POST; DELETE, PUT requests. Model: Im memory data: This is just a mock data. package he 阅读全文
posted @ 2019-01-14 20:32 Zhentiw 阅读(329) 评论(0) 推荐(0) 编辑
摘要:In Spring boot, define a REST API endpoint is pretty easy. 阅读全文
posted @ 2018-09-08 18:27 Zhentiw 阅读(177) 评论(0) 推荐(0) 编辑
摘要:We might have some project specific configuration need to setup. The good approach to do this in Sprint is using 'Proptries'. In resouces/applicationC 阅读全文
posted @ 2018-09-02 14:43 Zhentiw 阅读(244) 评论(0) 推荐(0) 编辑
摘要:We can define a class to be Singleton or Prototype. If the class was defined as Prototype, then everytime when we use new keyword, it will create a ne 阅读全文
posted @ 2018-09-02 13:36 Zhentiw 阅读(131) 评论(0) 推荐(0) 编辑
摘要:There is no applicationContext.xml file. Too much XML Namespaces helped Enter Java Configuration Create main/java/com.pluralsight/AppConfig.java: 1. S 阅读全文
posted @ 2018-08-27 03:02 Zhentiw 阅读(304) 评论(0) 推荐(0) 编辑
摘要:Add context to our application. main/resources/applicationContext.xml: Using annotation for @Service @Repository @Controller: /repository/HibernateCus 阅读全文
posted @ 2018-08-22 01:46 Zhentiw 阅读(180) 评论(0) 推荐(0) 编辑
摘要:Previous we have seen constructore injection: https://www.cnblogs.com/Answer1215/p/9484872.html It would be easier to using autowire to reduce the cod 阅读全文
posted @ 2018-08-16 01:06 Zhentiw 阅读(276) 评论(0) 推荐(0) 编辑
摘要:Previous we see how to do Setter injection: https://www.cnblogs.com/Answer1215/p/9472117.html Now let's see how to cover setter injection to coustruct 阅读全文
posted @ 2018-08-16 00:50 Zhentiw 阅读(181) 评论(0) 推荐(0) 编辑
摘要:In CustomerServiceImpl.java, we hardcoded 'HibernateCustomerRepositoryImpl' To remove hardcoded Repository, we can use Setter Injection. First, we def 阅读全文
posted @ 2018-08-14 02:26 Zhentiw 阅读(278) 评论(0) 推荐(0) 编辑
摘要:We mainly need to modify our Model and REST endpoint code to enable swagger Document. model/Book.java: By doing this, we can get each model defination 阅读全文
posted @ 2018-08-06 00:34 Zhentiw 阅读(415) 评论(0) 推荐(0) 编辑
摘要:1. We have the BookEndpoint.java: 2. Creating a test for the REST endpoint: 阅读全文
posted @ 2018-08-04 23:07 Zhentiw 阅读(287) 评论(0) 推荐(0) 编辑
摘要:1. Create a rest folder with JAXRSConfiguration.java: 2. Create Endpoint file: BookEndpoint.java: 阅读全文
posted @ 2018-08-04 22:31 Zhentiw 阅读(473) 评论(0) 推荐(0) 编辑
摘要:So what is a Bean, in JavaEE, any class expect Entity are Bean. One usefully thing in Bean is Dependency injection. Just like Angular, it is just a Cl 阅读全文
posted @ 2018-08-03 02:00 Zhentiw 阅读(213) 评论(0) 推荐(0) 编辑
摘要:When we create Entity and Respority, we also need to do validations to protect our data. In Java, validations are built-in, using decorators. For Type 阅读全文
posted @ 2018-08-01 16:17 Zhentiw 阅读(396) 评论(0) 推荐(0) 编辑
摘要:We have model like this: 1 package com.pluralsight.bookstore.model; 2 3 import javax.persistence.*; 4 import java.util.Date; 5 6 /** 7 * @author Anton 阅读全文
posted @ 2018-07-30 22:27 Zhentiw 阅读(348) 评论(0) 推荐(0) 编辑
摘要:Mainly two things: 1. For all the creating and deleting opreations for the DB, we want to use 'REQUIRED' for the transaction. 2. For all the read only 阅读全文
posted @ 2018-07-27 02:49 Zhentiw 阅读(396) 评论(0) 推荐(0) 编辑
摘要:To bootsrap the application use the following Maven archetype: mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee 阅读全文
posted @ 2018-07-24 02:21 Zhentiw 阅读(267) 评论(0) 推荐(0) 编辑
摘要:package com.learning; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; im 阅读全文
posted @ 2013-09-16 14:47 Zhentiw 编辑

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