cn.willingxyz.restdoc.springswagger3.SpringSwagger3Controller.orig Maven / Gradle / Ivy
package cn.willingxyz.restdoc.springswagger3;
import cn.willingxyz.restdoc.core.parse.IRestDocParser;
<<<<<<< HEAD:RestDocSpringSwagger3/src/main/java/cn/willingxyz/restdoc/springswagger3/SpringSwagger3Controller.java
import org.springframework.beans.factory.annotation.Qualifier;
=======
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
>>>>>>> master:RestDocSpringSwagger3/src/main/java/cn/willingxyz/restdoc/springswagger3/SpringSwaggerController.java
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class SpringSwagger3Controller {
private SwaggerUIConfiguration _uiConfiguration;
private IRestDocParser _docParser;
private String _docCache;
<<<<<<< HEAD:RestDocSpringSwagger3/src/main/java/cn/willingxyz/restdoc/springswagger3/SpringSwagger3Controller.java
public SpringSwagger3Controller(@Qualifier("swagger3") IRestDocParser docParser)
=======
private ObjectMapper _objectMapper = new ObjectMapper();
public SpringSwaggerController(IRestDocParser docParser, SwaggerUIConfiguration uiConfiguration)
>>>>>>> master:RestDocSpringSwagger3/src/main/java/cn/willingxyz/restdoc/springswagger3/SpringSwaggerController.java
{
_docParser = docParser;
_uiConfiguration = uiConfiguration;
}
@GetMapping(value = {"/swagger.json", "/swagger3.json"})
public String swaggerJson()
{
// if (_docCache != null)
// return _docCache;
_docCache = _docParser.parse();
return _docCache;
}
@GetMapping("/swaggerUIConfiguration")
public String swaggerUIConfiguration() throws JsonProcessingException {
return _objectMapper.writeValueAsString(_uiConfiguration);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy