Skip to content

Commit a1c80a0

Browse files
committed
Update swagger dependencies
1 parent 4973fe8 commit a1c80a0

18 files changed

+145
-249
lines changed

pom.xml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.springframework.boot</groupId>
66
<artifactId>spring-boot-starter-parent</artifactId>
7-
<version>2.5.6</version>
7+
<version>2.6.1</version>
88
<relativePath /> <!-- lookup parent from repository -->
99
</parent>
1010
<groupId>com.github.throyer.common.spring-boot</groupId>
@@ -14,7 +14,7 @@
1414
<description>Exemplo de api simples com Spring Boot</description>
1515

1616
<properties>
17-
<java.version>16</java.version>
17+
<java.version>17</java.version>
1818
</properties>
1919

2020
<pluginRepositories>
@@ -67,7 +67,7 @@
6767
<dependency>
6868
<groupId>org.springframework.security</groupId>
6969
<artifactId>spring-security-data</artifactId>
70-
<version>5.5.0</version>
70+
<version>5.6.0</version>
7171
</dependency>
7272

7373

@@ -83,10 +83,20 @@
8383

8484
<!-- swagger -->
8585
<dependency>
86-
<groupId>io.springfox</groupId>
87-
<artifactId>springfox-boot-starter</artifactId>
88-
<version>3.0.0</version>
89-
</dependency>
86+
<groupId>org.springdoc</groupId>
87+
<artifactId>springdoc-openapi-ui</artifactId>
88+
<version>1.5.13</version>
89+
</dependency>
90+
<dependency>
91+
<groupId>org.springdoc</groupId>
92+
<artifactId>springdoc-openapi-webmvc-core</artifactId>
93+
<version>1.5.13</version>
94+
</dependency>
95+
<dependency>
96+
<groupId>org.springdoc</groupId>
97+
<artifactId>springdoc-openapi-security</artifactId>
98+
<version>1.5.13</version>
99+
</dependency>
90100

91101
<!-- Token JWT -->
92102
<dependency>
@@ -171,7 +181,7 @@
171181
<plugin>
172182
<groupId>com.github.throyer</groupId>
173183
<artifactId>migration-maven-plugin</artifactId>
174-
<version>1.2.3</version>
184+
<version>1.2.5</version>
175185
</plugin>
176186
<plugin>
177187
<groupId>org.springframework.boot</groupId>

src/main/java/com/github/throyer/common/springboot/configurations/SpringWebConfiguration.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@
55
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
66
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
77
import org.springframework.web.servlet.config.annotation.CorsRegistry;
8-
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
9-
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
108
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
119

10+
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
11+
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
12+
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
13+
import io.swagger.v3.oas.annotations.info.Info;
14+
import io.swagger.v3.oas.annotations.security.SecurityScheme;
15+
1216
@Configuration
17+
@OpenAPIDefinition(info = @Info(title = "Common API", version = "v1"))
18+
@SecurityScheme(
19+
name = "token",
20+
type = SecuritySchemeType.HTTP,
21+
bearerFormat = "JWT",
22+
in = SecuritySchemeIn.HEADER,
23+
scheme = "bearer"
24+
)
1325
public class SpringWebConfiguration implements WebMvcConfigurer {
1426

1527
@Override

src/main/java/com/github/throyer/common/springboot/configurations/SwaggerConfiguration.java

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

src/main/java/com/github/throyer/common/springboot/controllers/api/ApiController.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.github.throyer.common.springboot.controllers.api;
22

3+
import com.github.throyer.common.springboot.utils.Hello;
4+
35
import org.springframework.web.bind.annotation.GetMapping;
46
import org.springframework.web.bind.annotation.RequestMapping;
57
import org.springframework.web.bind.annotation.RestController;
68

7-
import io.swagger.annotations.Api;
8-
import com.github.throyer.common.springboot.utils.Hello;
9-
10-
@Api(tags = "Status check", produces = "application/json")
119
@RestController
1210
@RequestMapping("/api")
1311
public class ApiController {

src/main/java/com/github/throyer/common/springboot/controllers/api/RecoveriesController.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.github.throyer.common.springboot.controllers.api;
22

3+
import static org.springframework.http.HttpStatus.NO_CONTENT;
4+
35
import com.github.throyer.common.springboot.domain.services.recovery.RecoveryConfirmService;
46
import com.github.throyer.common.springboot.domain.services.recovery.RecoveryService;
57
import com.github.throyer.common.springboot.domain.services.recovery.RecoveryUpdateService;
6-
import static org.springframework.http.HttpStatus.NO_CONTENT;
7-
88
import com.github.throyer.common.springboot.domain.services.user.dto.RecoveryConfirm;
99
import com.github.throyer.common.springboot.domain.services.user.dto.RecoveryRequest;
1010
import com.github.throyer.common.springboot.domain.services.user.dto.RecoveryUpdate;
@@ -16,9 +16,6 @@
1616
import org.springframework.web.bind.annotation.ResponseStatus;
1717
import org.springframework.web.bind.annotation.RestController;
1818

19-
import io.swagger.annotations.Api;
20-
21-
@Api(tags = "Password recovery", produces = "application/json")
2219
@RestController
2320
@RequestMapping("/api/recoveries")
2421
public class RecoveriesController {

src/main/java/com/github/throyer/common/springboot/controllers/api/RolesController.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
import org.springframework.web.bind.annotation.RequestMapping;
1515
import org.springframework.web.bind.annotation.RestController;
1616

17-
import io.swagger.annotations.Api;
18-
19-
@Api(tags = "User role")
2017
@RestController
2118
@RequestMapping("/api/roles")
2219
@PreAuthorize("hasAnyAuthority('ADM')")

src/main/java/com/github/throyer/common/springboot/controllers/api/SessionsController.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
import org.springframework.web.bind.annotation.RequestMapping;
1616
import org.springframework.web.bind.annotation.RestController;
1717

18-
import io.swagger.annotations.Api;
19-
20-
@Api(tags = "Session")
2118
@RestController
2219
@RequestMapping("/api/sessions")
2320
public class SessionsController {

src/main/java/com/github/throyer/common/springboot/controllers/api/UsersController.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
import org.springframework.web.bind.annotation.ResponseStatus;
3131
import org.springframework.web.bind.annotation.RestController;
3232

33-
import io.swagger.annotations.Api;
34-
35-
@Api(tags = "User")
3633
@RestController
3734
@RequestMapping("/api/users")
3835
public class UsersController {
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
package db.migration;
22

3-
import static org.jooq.impl.DSL.currentTimestamp;
4-
import static org.jooq.impl.DSL.foreignKey;
5-
import static org.jooq.impl.DSL.primaryKey;
6-
import static org.jooq.impl.DSL.unique;
7-
import static org.jooq.impl.DSL.using;
8-
import static org.jooq.impl.SQLDataType.BIGINT;
9-
import static org.jooq.impl.SQLDataType.BOOLEAN;
10-
import static org.jooq.impl.SQLDataType.TIMESTAMP;
11-
import static org.jooq.impl.SQLDataType.VARCHAR;
12-
3+
import static org.jooq.impl.DSL.*;
4+
import static org.jooq.impl.SQLDataType.*;
135
import org.flywaydb.core.api.migration.BaseJavaMigration;
146
import org.flywaydb.core.api.migration.Context;
157

16-
public class V2021052905151622319358__create_table_user extends BaseJavaMigration {
8+
/**
9+
* @see https://www.jooq.org/doc/3.1/manual/sql-building/ddl-statements/
10+
*/
11+
public class V1639097360419__CreateTableUser extends BaseJavaMigration {
1712
public void migrate(Context context) throws Exception {
1813
var create = using(context.getConnection());
1914
create.transaction(configuration -> {
2015
using(configuration)
21-
.createTableIfNotExists("user")
16+
.createTableIfNotExists("user")
2217
.column("id", BIGINT.identity(true))
2318
.column("name", VARCHAR(100).nullable(false))
2419
.column("email", VARCHAR(100).nullable(true))
@@ -31,13 +26,13 @@ public void migrate(Context context) throws Exception {
3126
.column("created_by", BIGINT.nullable(true))
3227
.column("updated_by", BIGINT.nullable(true))
3328
.column("deleted_by", BIGINT.nullable(true))
34-
.constraints(
35-
primaryKey("id"),
36-
unique("email"),
37-
foreignKey("created_by").references("user", "id"),
38-
foreignKey("updated_by").references("user", "id"),
39-
foreignKey("deleted_by").references("user", "id"))
40-
.execute();
29+
.constraints(
30+
primaryKey("id"),
31+
unique("email"),
32+
foreignKey("created_by").references("user", "id"),
33+
foreignKey("updated_by").references("user", "id"),
34+
foreignKey("deleted_by").references("user", "id"))
35+
.execute();
4136
});
4237
}
43-
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
package db.migration;
22

3-
import static org.jooq.impl.DSL.currentTimestamp;
4-
import static org.jooq.impl.DSL.foreignKey;
5-
import static org.jooq.impl.DSL.primaryKey;
6-
import static org.jooq.impl.DSL.unique;
7-
import static org.jooq.impl.DSL.using;
8-
import static org.jooq.impl.SQLDataType.BIGINT;
9-
import static org.jooq.impl.SQLDataType.BOOLEAN;
10-
import static org.jooq.impl.SQLDataType.TIMESTAMP;
11-
import static org.jooq.impl.SQLDataType.VARCHAR;
12-
3+
import static org.jooq.impl.DSL.*;
4+
import static org.jooq.impl.SQLDataType.*;
135
import org.flywaydb.core.api.migration.BaseJavaMigration;
146
import org.flywaydb.core.api.migration.Context;
157

16-
public class V2021052905531622321601__create_table_role extends BaseJavaMigration {
8+
/**
9+
* @see https://www.jooq.org/doc/3.1/manual/sql-building/ddl-statements/
10+
*/
11+
public class V1639097454131__CreateTableRole extends BaseJavaMigration {
1712
public void migrate(Context context) throws Exception {
1813
var create = using(context.getConnection());
1914
create.transaction(configuration -> {
2015
using(configuration)
21-
.createTableIfNotExists("role")
16+
.createTableIfNotExists("role")
2217
.column("id", BIGINT.identity(true))
2318
.column("name", VARCHAR(100).nullable(false))
2419
.column("deleted_name", VARCHAR(100).nullable(true))
@@ -32,14 +27,14 @@ public void migrate(Context context) throws Exception {
3227
.column("created_by", BIGINT.nullable(true))
3328
.column("updated_by", BIGINT.nullable(true))
3429
.column("deleted_by", BIGINT.nullable(true))
35-
.constraints(
36-
primaryKey("id"),
37-
unique("name"),
38-
unique("initials"),
39-
foreignKey("created_by").references("user", "id"),
40-
foreignKey("updated_by").references("user", "id"),
41-
foreignKey("deleted_by").references("user", "id"))
42-
.execute();
30+
.constraints(
31+
primaryKey("id"),
32+
unique("name"),
33+
unique("initials"),
34+
foreignKey("created_by").references("user", "id"),
35+
foreignKey("updated_by").references("user", "id"),
36+
foreignKey("deleted_by").references("user", "id"))
37+
.execute();
4338
});
4439
}
45-
}
40+
}

0 commit comments

Comments
 (0)