java - 框架搭建,接口调用
ringa_lee
ringa_lee 2017-04-18 09:05:31
0
9
430

1.读取网上在线的restful API接口,比如天气,IP这样,还有基于oauth2.0这样的。
2.保存一份数据在本地MYSQL、和SQLSERVER上
3.对外发布服务,同样的restful API接口
求指导,,实在不知道用什么框架,去构架啊。。

ringa_lee
ringa_lee

ringa_lee

reply all(9)
大家讲道理

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.

Peter_Zhu

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

  1. spring

  2. retrofit

  3. okhttp

  4. gson

  5. oltu.oauth2

  6. mybatis or hibernate

  7. 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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template