zoukankan      html  css  js  c++  java
  • jQuery火箭图标返回顶部代码

    首先,添加mvc框架(略)以及Swagger Maven依赖:

      <dependency>
           <groupId>io.springfox</groupId>
           <artifactId>springfox-swagger2</artifactId>
           <version>2.7.0</version>
      </dependency>
    
      <dependency>
           <groupId>io.springfox</groupId>
           <artifactId>springfox-swagger-ui</artifactId>
           <version>2.7.0</version>
      </dependency>
    
      <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
          <version>2.9.4</version>
      </dependency>

      1>  配置servler-mvc.xml:

        <mvc:annotation-driven/>
    
        <mvc:default-servlet-handler/>
       
       <!-- 开启注解扫描,用来扫描拥有swagger注解的handler -->
        <context:component-scan base-package="com.bingco.controller" />
    
      <!-- 扫描注解configuration,这里配置了只扫描路径包下的类 -->
      <context:component-scan base-package="com.bingco" resource-pattern="SwaggerConfig.class" />
    
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

        <property name="prefix" value="/WEB-INF/templates/"/> <property name="suffix" value=".ftl"/>

      </bean>       <!-- 这是 Swagger UI Maven 中的资源,做好映射 --> <mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/> <mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>

      2>  创建类SwaggerConfig:

    @Configuration // 必须存在
    // @EnableWebMvc 用来启用MVC配置的,主要在Spring boot中使用,这个demo是配置式的,用不着
    @EnableSwagger2 // 必须存在
    @ComponentScan(basePackages = {"com.bingco.controller"}) // 不是必须,可以在配置文件中开启扫描
    public class SwaggerConfig {
        @Bean
        public Docket customDocket() {
            return new Docket(DocumentationType.SWAGGER_2)
                    .apiInfo(apiInfo());
        }
    
        private ApiInfo apiInfo() {
            Contact contact = new Contact("小明", "http://www.cnblogs.com/getupmorning/", "zhaoming0018@126.com"); // 相当于明信片
            return new ApiInfoBuilder()
                    .title("前台API接口") // 标题
                    .description("前台API接口") // 描述
                    .contact(contact)
                    .version("1.1.0") // 版本
                    .build();
        }
    }

     

                    访问项目:http://127.0.0.1:80/swagger-ui.html (提示:如果访问时有弹窗提示url问题的,可以把IP换成localhost)

                                              -- over --

  • 相关阅读:
    ios开发,NSFileManager的使用
    iOS开发-常用第三方开源框架介绍(绝对够你用了)
    iOS开发常用第三方开源框架
    对佛学和个人发展的思考总结(十八)心流、非人情网络、穷人、人生机会、平衡计分卡
    php 判断字符串中包含重复相同的次数 array_count_values str_split max 函数组合使用
    存储过程一次性返回多个数据集,逻辑层与前端处理
    动态改变div背景颜色
    在asp.net mvc应用中使用vue.js
    angularjs单一页面中高频访问相同web api,出现阻塞和等待
    Windows安装配置OpenGrok
  • 原文地址:https://www.cnblogs.com/bingco/p/8817074.html
Copyright © 2011-2022 走看看