Skip to content

Commit 639f1c8

Browse files
authored
Merge pull request #6 from jarlehansen/release-1.2.0
Release 1.2.0
2 parents d2ed8b3 + db5597e commit 639f1c8

16 files changed

+99
-324
lines changed

README.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ __Features:__
1313
* Support for using Spring placeholder values `${...}` in the configuration
1414
* Easy to extend by using the standard Springfox classes
1515
* Convention based naming of values displayed in swagger-ui, minimizing the need for manual configuration
16-
* Can display all the `@Value` annotations used, with the key and the default value
1716

1817
---
1918

@@ -36,7 +35,7 @@ The jar-file available in [JCenter](https://bintray.com/jarlehansen/maven/spring
3635

3736
_build.gradle_
3837
```groovy
39-
compile('com.github.springfox.loader:springfox-loader:1.1.2')
38+
compile('com.github.springfox.loader:springfox-loader:1.2.0')
4039
```
4140

4241
### Maven
@@ -84,7 +83,6 @@ __Full example__
8483
```java
8584
@EnableSpringfox(
8685
conventionMode = false,
87-
listValueProps = true,
8886
swaggerUiBasePath = "",
8987
includeControllers = MyController.class,
9088
value = @Info(
@@ -93,15 +91,17 @@ __Full example__
9391
description = "",
9492
termsOfService = "",
9593
contact = @Contact(name = "", url = "", email = ""),
96-
license = @License(name = "", url = ""))
97-
)
94+
license = @License(name = "", url = ""),
95+
extensions = @Extension(name = "x-test",
96+
properties = @ExtensionProperty(name = "test-key", value = "test-value")
97+
))
98+
)
9899
```
99100

100101
* Use __conventionMode__ to print better names on the swagger-ui page. It will alter the tags (the name of the groups).
101102
It will remove _Controller_ at the end of the text if it is present. Additionally, it will split the operation name by
102103
replacing camelcase with space and uppercasing the word (for example the method `getCustomer()` will be displayed as `Get customer`).
103104
If the `@ApiOperation` annotation is present, these values will be used.
104-
* __listValueProps__ is used to enable an endpoint that will display all the `@Value`-annotations (key and default value) used in the application. The endpoint is displayed in swagger-ui as 'Value-properties'. By default this is disabled.
105105
* __swaggerUiBasePath__ customize the base path to swagger-ui. If the value is for example '/documentation', the path to swagger-ui will be '/documentation/swagger-ui.html'.
106106
* __includeControllers__ add controllers to the swagger configuration that is not registered in the default base package (which is based on the Application class).
107107

@@ -126,7 +126,6 @@ __Application properties__
126126
* springfox.license.url
127127
* springfox.activeProfiles - _Enable springfox for the configured profiles. If not set, all profiles loads springfox. Default is all profiles._
128128
* springfox.swagger-ui-base-path
129-
* springfox.endpoints - _Enables springfox-loader endpoints, see [Springfox loader endpoints](#springfox-loader-endpoints) for more details_
130129

131130
### Swagger UI
132131

@@ -150,12 +149,6 @@ public void init() {
150149
}
151150
```
152151

153-
### Springfox loader endpoints
154-
155-
`GET /springfox-loader/api-docs`
156-
157-
Returns the swagger api-docs with [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) enabled.
158-
159152
### References
160153
* [Springfox Reference Documentation](http://springfox.github.io/springfox/docs/current/)
161154
* [Swagger Core Annotations](https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X)

pom.xml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.github.springfox.loader</groupId>
77
<artifactId>springfox-loader</artifactId>
8-
<version>1.1.3-SNAPSHOT</version>
8+
<version>1.2.0-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010

1111
<properties>
@@ -15,7 +15,6 @@
1515
<cglib.version>3.2.5</cglib.version>
1616
<jackson.version>2.8.8</jackson.version>
1717
<lombok.version>1.16.16</lombok.version>
18-
<reflections.version>0.9.11</reflections.version>
1918
<guava.version>22.0</guava.version>
2019
<jsonpath.version>2.2.0</jsonpath.version>
2120

@@ -63,28 +62,24 @@
6362
<version>${spring.version}</version>
6463
<optional>true</optional>
6564
</dependency>
66-
<dependency>
67-
<groupId>org.reflections</groupId>
68-
<artifactId>reflections</artifactId>
69-
<version>${reflections.version}</version>
70-
</dependency>
7165
<dependency>
7266
<groupId>com.google.guava</groupId>
7367
<artifactId>guava</artifactId>
7468
<version>${guava.version}</version>
7569
</dependency>
76-
<dependency>
77-
<groupId>com.jayway.jsonpath</groupId>
78-
<artifactId>json-path</artifactId>
79-
<version>${jsonpath.version}</version>
80-
</dependency>
8170
<dependency>
8271
<groupId>org.projectlombok</groupId>
8372
<artifactId>lombok</artifactId>
8473
<version>${lombok.version}</version>
8574
<scope>provided</scope>
8675
</dependency>
8776

77+
<dependency>
78+
<groupId>com.jayway.jsonpath</groupId>
79+
<artifactId>json-path</artifactId>
80+
<version>${jsonpath.version}</version>
81+
<scope>test</scope>
82+
</dependency>
8883
<dependency>
8984
<groupId>cglib</groupId>
9085
<artifactId>cglib-nodep</artifactId>
@@ -144,7 +139,7 @@
144139
<plugin>
145140
<groupId>org.apache.maven.plugins</groupId>
146141
<artifactId>maven-surefire-plugin</artifactId>
147-
<version>2.19.1</version>
142+
<version>2.20</version>
148143
<configuration>
149144
<includes>
150145
<include>**/*Spec.java</include>

src/main/java/com/github/springfox/loader/EnableSpringfox.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
boolean conventionMode() default true;
2323

24-
boolean listValueProps() default false;
25-
2624
Class<?>[] includeControllers() default {};
2725

2826
}

src/main/java/com/github/springfox/loader/SpringfoxLoader.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ boolean conventionMode() {
103103
return annotation.conventionMode();
104104
}
105105

106-
boolean listValueProps() {
107-
return annotation.listValueProps();
108-
}
109-
110106
String swaggerUiBasePath() {
111107
return val(annotation.swaggerUiBasePath(), loaderProps.getSwaggerUiBasePath());
112108
}

src/main/java/com/github/springfox/loader/SpringfoxLoaderConfig.java

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import com.github.springfox.loader.plugins.LoaderOperationPlugin;
44
import com.github.springfox.loader.plugins.LoaderTagProvider;
5-
import com.github.springfox.loader.valueproperties.ValuePropertiesController;
6-
import com.github.springfox.loader.valueproperties.ValuePropertiesLocator;
75
import io.swagger.annotations.Extension;
86
import io.swagger.annotations.ExtensionProperty;
97
import org.springframework.beans.BeansException;
@@ -30,7 +28,6 @@
3028
import springfox.documentation.spring.web.plugins.Docket;
3129
import springfox.documentation.spring.web.readers.operation.DefaultTagsProvider;
3230

33-
import javax.annotation.PostConstruct;
3431
import java.util.Arrays;
3532
import java.util.Collections;
3633
import java.util.List;
@@ -42,23 +39,11 @@
4239
@ComponentScan(basePackageClasses = SpringfoxLoaderConfig.class)
4340
public class SpringfoxLoaderConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware, EmbeddedValueResolverAware {
4441

45-
@Autowired
46-
private ValuePropertiesController valuePropertiesController;
47-
4842
private SpringfoxLoader springfoxLoader = new SpringfoxLoader();
49-
private ValuePropertiesLocator valuePropertiesLocator;
5043

5144
@Override
5245
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
5346
springfoxLoader.setApplicationContext(applicationContext);
54-
if (springfoxLoader.listValueProps()) {
55-
valuePropertiesLocator = new ValuePropertiesLocator(springfoxLoader.getBasePackage());
56-
}
57-
}
58-
59-
@PostConstruct
60-
public void init() {
61-
valuePropertiesController.setValuePropertiesLocator(valuePropertiesLocator);
6247
}
6348

6449
@Override
@@ -76,11 +61,6 @@ public void setSpringfoxLoaderProps(SpringfoxLoaderProps loaderProps) {
7661
public Docket api() {
7762
ApiSelectorBuilder apiSelectorBuilder = new Docket(DocumentationType.SWAGGER_2).select();
7863
Predicate<RequestHandler> predicate = RequestHandlerSelectors.basePackage(springfoxLoader.getBasePackage())::apply;
79-
if (springfoxLoader.listValueProps()) {
80-
Predicate<RequestHandler> listPropertiesRequestHandler = RequestHandlerSelectors.basePackage(ValuePropertiesController.class.getPackage().getName())::apply;
81-
predicate = predicate.or(listPropertiesRequestHandler);
82-
}
83-
8464
if (springfoxLoader.includeControllers().length > 0) {
8565
Class<?>[] controllers = springfoxLoader.includeControllers();
8666
for (Class<?> controller : controllers) {
@@ -108,12 +88,10 @@ private List<VendorExtension> getVendorExtensions() {
10888

10989
return Arrays.stream(extensions).map(extension -> {
11090
ExtensionProperty[] extensionProperties = extension.properties();
111-
List<StringVendorExtension> vendorExtensions = Arrays.stream(extensionProperties).map(property -> new StringVendorExtension(property.name(), property.value())).collect(Collectors.toList());
112-
91+
List<StringVendorExtension> vendorExtensions = Arrays.stream(extensionProperties)
92+
.map(property -> new StringVendorExtension(property.name(), property.value())).collect(Collectors.toList());
11393
ObjectVendorExtension vendorExtension = new ObjectVendorExtension(extension.name());
114-
for (StringVendorExtension stringVendorExtension : vendorExtensions) {
115-
vendorExtension.addProperty(stringVendorExtension);
116-
}
94+
vendorExtensions.forEach(vendorExtension::addProperty);
11795
return vendorExtension;
11896
}).collect(Collectors.toList());
11997
}
@@ -131,10 +109,6 @@ public LoaderOperationPlugin loaderOperationPlugin() {
131109
return new LoaderOperationPlugin(springfoxLoader.conventionMode());
132110
}
133111

134-
ValuePropertiesLocator valuePropertiesLocator() {
135-
return valuePropertiesLocator;
136-
}
137-
138112
@Override
139113
public void addViewControllers(ViewControllerRegistry registry) {
140114
if (!StringUtils.isEmpty(springfoxLoader.swaggerUiBasePath())) {

src/main/java/com/github/springfox/loader/controller/SpringfoxLoaderController.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/main/java/com/github/springfox/loader/valueproperties/ValuePropertiesController.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/main/java/com/github/springfox/loader/valueproperties/ValuePropertiesLocator.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/main/java/com/github/springfox/loader/valueproperties/ValueProperty.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)