@Api(value = "/v1/", description = "Test API", produces = "application/json")
@RestController
@RequestMapping("/v1/")
class SampleRestController {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully added"),
@ApiResponse(code = 416, message = "List is empty") })
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE, value = "samples/{sb}",
method = RequestMethod.GET)
public Map<String, String> sbs(@PathVariable("sb") String sb) {
}
@ApiOperation(
value = "Seeing where this shows up",
notes = "we should see this in the implememtation notes",
response = Sample.class,
httpMethod = "GET"
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully added"),
@ApiResponse(code = 416, message = "List is empty") })
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE, value = "samples/{pb}",
method = RequestMethod.GET)
public Sample ps(@PathVariable String pb) {
}
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE, value = "samples",
method = RequestMethod.GET)
public Collection<Map<String, String>> cs(@RequestParam(value = "cid", required = true, defaultValue = "")
String cid) {
}
}
{"swagger":"2.0","info":{"description":"All about the Samples","title":"Samples API","contact":{},"license":{}},"host":"localhost:8080","basePath":"/","tags":[{"name":"sample-rest-controller","description":"Sample Rest Controller"}],
"paths":{
"/v1/samples":{"get":{"tags":["sample-rest-controller"],"summary":"cs","operationId":"csUsingGET","consumes":["application/json"],"produces":["application/json"],"parameters":[{"name":"cid","in":"query","description":"cid","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«Map«string,string»»"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},
"/v1/samples/{pb}":{"get":{"tags":["sample-rest-controller"],"summary":"ps","operationId":"psUsingGET","consumes":["application/json"],"produces":["application/json"],"parameters":[{"name":"pb","in":"path","description":"pb","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Sample"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},
"/v1/samples/{sb}":{"get":{"tags":["sample-rest-controller"],"summary":"sbs","operationId":"sbsUsingGET","consumes":["application/json"],"produces":["application/json"],"parameters":[{"name":"sb","in":"path","description":"sb","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"object","additionalProperties":{"type":"string"}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}}},
我在玩,把我的进口从
导入com.wordnik.swagger.annotations.;
至
我正在尝试在数据库中保存对象。正在执行代码并创建实体的Id,但实体未持久化到数据库(未插入行): 从三行(beginTransation,flush,commit)中删除注释解决了问题,但是为什么注释在这里不起作用呢? spring XML: POM xml文件:
我在玩和 这是我的应用程序上下文文件 以下是我的Java类 HelloWorld1。JAVA 住址JAVA 这里是我尝试运行东西的地方-应用程序。JAVA 我一直在得到这个异常-理想情况下我不应该,因为我已经定义了id为'address1'的@Qualifier注释-所以它不应该抛出异常 警告:上下文初始化过程中遇到的异常-取消刷新尝试:org.springframework.beans.fact
我的spring应用程序有点小问题。下面是我的代码: (存储库) 下面是我的简单服务类: 更新:配置
我将Spring 3.2.4与JavaFX结合使用,并希望实现一种方法,其中操作将在事务中执行。我在控制器中的代码如下所示: 以及我的应用程序上下文: 尝试运行时,我收到以下错误消息: 该方法存在。删除注释,或者将方法从public更改为private,或者从配置中删除bean,程序就会运行,但事务注释根本不起作用。删除代理目标会导致另一个错误。
你好,朋友,我正在开发基于spring(4.0.3)和hibernate(4.3.6)的应用程序。在会话工厂中保存任何对象时,我遇到以下错误: 下面是我在application-context.xml中使用的条目 还有一件事我想带到这里,如果我在事务管理器属性中使用了任何值,而不是实际的transactionManager作为bean引用,那么这不是抛出错误。所以我认为它没有参考价值<请帮帮我!!
但是,由于某种原因,总是,所以我不确定这是注释类的问题还是我使用反射的方式的问题。我很确定是后者,因为在调试时,我发现它能够访问带有注释的方法。如有任何帮助,不胜感激,谢谢!