It feels like you have two needs, one is to read the api and then store it in the database, and the other is to read the data from the database and write it to the api.
It doesn’t matter if the former requirement doesn’t apply to a framework, but for the latter one, just use a web framework such as Spring MVC.
I agree with the idea of listen. To read the restful api, you can write an http request. After getting the data, parse it and save it to the local database. You can use jdbc. You can use mybatis to use the framework. Use spring mvc on the front end to design the restful interface. Provide services outside. Coupled with the spring framework, a complete set can be used to create a javaEE application.
I still use spring MVC, and there is a lot of information online. If there is a problem, you can search a lot of information on Baidu. Later maintenance will be better
Step by step solution 1. Read restful requests, use http 2. Save the database, use hibernate mybatis, beetsql or write your own jdbc database operation. 3. There are many materials and frameworks for publishing RESTful. . Since the function is relatively simple, just use spring mvc.
Most companies now use REST services to provide API calls. REST is also a lightweight webservice service. It is recommended to use springmvc+mybatis framework integration and use REST style to write APIs.
1. You can use httpclient, or simply use APIs such as URLConnection that come with jdk. 2. Save data to the database using jdbc+ database driver. Of course, you can also use persistence layer frameworks such as hibernate and mybatis. 3 . Publishing services to the outside world can be done by simply using servlets. There are many frameworks, including springmvc, jersey, etc.
It feels like you have two needs, one is to read the api and then store it in the database, and the other is to read the data from the database and write it to the api.
It doesn’t matter if the former requirement doesn’t apply to a framework, but for the latter one, just use a web framework such as
Spring MVC
.I agree with the idea of listen. To read the restful api, you can write an http request. After getting the data, parse it and save it to the local database. You can use jdbc. You can use mybatis to use the framework. Use spring mvc on the front end to design the restful interface. Provide services outside. Coupled with the spring framework, a complete set can be used to create a javaEE application.
I still use spring MVC, and there is a lot of information online. If there is a problem, you can search a lot of information on Baidu. Later maintenance will be better
Step by step solution
1. Read restful requests, use http
2. Save the database, use hibernate mybatis, beetsql or write your own jdbc database operation.
3. There are many materials and frameworks for publishing RESTful. .
Since the function is relatively simple, just use spring mvc.
springmvc restful how to
Most companies now use REST services to provide API calls. REST is also a lightweight webservice service. It is recommended to use springmvc+mybatis framework integration and use REST style to write APIs.
I have done several similar projects and used several basic dependencies, you can refer to them directly
spring
retrofit
okhttp
gson
oltu.oauth2
mybatis or hibernate
some tools
Question 1. Data acquisition
api call You need libraries like okhttp, http-component
oauth login process, you can refer to the spring-social module
Question 2. Data persistence
Save to relational database You may need a framework like spring-data-jpa to simplify your processing logic
Question 3. Release of services
To publish restful services, you can use the spring-mvc framework.
For questions 2 and 3, you can even use spring boot to integrate multiple frameworks to simplify development.
You can refer to a small demo I made, which is partially similar to your needs.
In short, you need to look more at Java resource collection
1. You can use httpclient, or simply use APIs such as URLConnection that come with jdk.
2. Save data to the database using jdbc+ database driver. Of course, you can also use persistence layer frameworks such as hibernate and mybatis.
3 . Publishing services to the outside world can be done by simply using servlets. There are many frameworks, including springmvc, jersey, etc.