小编m.y*_*y.m的帖子

使用Java 9的Netbeans无法创建/ dis / lib

我有一个使用Java 8在NetBeans中开发的项目。现在,我迁移到Java 9,并且正在使用NetBeans的开发版本。当我使用Java 8平台构建项目时,一切正常,并且使用jar和项目主jar文件创建了/ dist / lib目录,但是当我使用java 9平台时,仅创建了项目主jar和/ dist / lib未创建。构建成功,我可以在IDE中运行项目,问题是当我运行项目jar时,缺少了应该位于/ dist / lib中的库jar。

java netbeans java-9

5
推荐指数
1
解决办法
651
查看次数

swagger 从属性文件中读取文档


我试图让 Swagger 从属性文件中读取 API 文档,swagger.properties但不能。在@ApiOperation注释中有一个错误说:Attribute value must be constant。有关如何解决此问题并能够从属性文件中读取文档的任何建议?
这是控制器代码:

package com.demo.student.demo.controller;

import com.demo.student.demo.entity.Student;
import com.demo.student.demo.service.StudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/v1/students")
@Api(description = "Set of endpoints for Creating, Retrieving, Updating and Deleting of Students.")
public class StudentController {
    private final String message;

    public StudentController(@Value("${test.swagger.message}") String message){
        this.message=message;
    }

    @Autowired
    private StudentService studentService;

    @GetMapping
    @ApiOperation(message)
    public List<Student> findAll(){
        return studentService.findAl();
    }

}
Run Code Online (Sandbox Code Playgroud)

而且,如何在@API(description) 的类级别注入一个值?

spring swagger swagger-ui spring-boot openapi

2
推荐指数
1
解决办法
2431
查看次数

标签 统计

java ×1

java-9 ×1

netbeans ×1

openapi ×1

spring ×1

spring-boot ×1

swagger ×1

swagger-ui ×1