Home  >  Q&A  >  body text

java - 框架搭建,接口调用

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

ringa_leeringa_lee2714 days ago390

reply all(9)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 09:07:31

    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.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 09:07:31

    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.

    reply
    0
  • 迷茫

    迷茫2017-04-18 09:07:31

    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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:07:31

    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.

    reply
    0
  • 迷茫

    迷茫2017-04-18 09:07:31

    springmvc restful how to

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-18 09:07:31

    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.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:07:31

    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

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:07:31

    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

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:07:31

    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.

    reply
    0
  • Cancelreply