In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
The editor will share with you a sample analysis of Java microservice application testing. I hope you will get something after reading this article. Let's discuss it together.
Package com.jeanron.licensesservice.domain; public class License {private String licenseId; private String organizationId; private String productName; private String licenseType; public String getLicenseId () {return licenseId;} public void setLicenseId (String licenseId) {this.licenseId = licenseId;} public String getOrganizationId () {return organizationId;} public void setOrganizationId (String organizationId) {this.organizationId = organizationId;} public String getProductName () {return productName;} public void setProductName (String productName) {this.productName = productName;} public String getLicenseType () {return licenseType } public void setLicenseType (String licenseType) {this.licenseType = licenseType;} public License withLicenseId (String licenseId) {this.setLicenseId (licenseId); return this;} public License withOrganizationId (String organizationId) {this.setOrganizationId (organizationId); return this;} public License withProductName (String productName) {this.setProductName (productName); return this;} public License withLicenseType (String licenseType) {this.setLicenseType (licenseType); return this;}
Package com.jeanron.licensesservice.controller; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.jeanron.licensesservice.domain.License / * * this annotation is equivalent to @ ResponseBody + @ Controller * serializes / deserializes request/response into JSON format * / @ RestController @ RequestMapping (value= "v1/organizations/ {organizationId} / licenses") public class LicenseServiceController {@ RequestMapping (value= "/ {licenseId}", method = RequestMethod.GET) public License getLicenses (@ PathVariable ("organizationId") String organizationId @ PathVariable ("licenseId") String licenseId) {/ / @ PathVariable can map {organizationId} and {licenseId} in URL to method variables organizationId, licenseId return new License () .withLicenseId (licenseId) .withOrganizationId (organizationId) .withProductName ("OpsAPI") .withLicenseType ("Database") } @ RequestMapping (value= "{licenseId}", method = RequestMethod.PUT) public String updateLicenses (@ PathVariable ("licenseId") String licenseId) {return String.format ("This is the put");} @ RequestMapping (value= "{licenseId}", method = RequestMethod.POST) public String saveLicenses (@ PathVariable ("licenseId") String licenseId) {return String.format ("This is the post") } @ RequestMapping (value= "{licenseId}", method = RequestMethod.DELETE) @ ResponseStatus (HttpStatus.NO_CONTENT) public String deleteLicenses (@ PathVariable ("licenseId") String licenseId) {return String.format ("This is the Delete");}}
Look at the OK code, but in the actual configuration, the environment configuration of the second class is a difficulty, it is easy to miss something, resulting in compilation failure. The only advice I can give is to be patient, more patient.
To start the service, it is very convenient to start in idea.
Through the browser, we can according to the input parameters, after processing, encapsulated into a json string return.
After reading this article, I believe you have some understanding of "sample Analysis of Java Micro Service Application testing". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.