Skip to content

Commit 0feb6bb

Browse files
committed
chore: migrate to spring-boot 3
1 parent 23336b2 commit 0feb6bb

File tree

6 files changed

+19
-16
lines changed

6 files changed

+19
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# kotlin-spring-boot-rest-jpa-jwt-starter
22

3-
[![Build Status](https://api.travis-ci.com/osahner/kotlin-spring-boot-rest-jpa-jwt-starter.svg?branch=develop)](https://github.com/osahner/kotlin-spring-boot-rest-jpa-jwt-starter/tree/develop)
4-
[![codecov](https://codecov.io/gh/osahner/kotlin-spring-boot-rest-jpa-jwt-starter/branch/develop/graph/badge.svg)](https://codecov.io/gh/osahner/kotlin-spring-boot-rest-jpa-jwt-starter/branch/develop/)
3+
[![Build Status](https://api.travis-ci.com/osahner/kotlin-spring-boot-rest-jpa-jwt-starter.svg?branch=develop)](https://app.travis-ci.com/github/osahner/kotlin-spring-boot-rest-jpa-jwt-starter)
4+
[![codecov](https://codecov.io/gh/osahner/kotlin-spring-boot-rest-jpa-jwt-starter/branch/main/graph/badge.svg)](https://codecov.io/gh/osahner/kotlin-spring-boot-rest-jpa-jwt-starter/branch/main/)
55

66

77
**Features**:

contributed/gen/REPLACEME.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package osahner.api.replaceme
22

3-
import javax.persistence.Entity
4-
import javax.persistence.GeneratedValue
5-
import javax.persistence.Id
3+
import jakarta.persistence.Table
4+
import jakarta.persistence.Entity
5+
import jakarta.persistence.GeneratedValue
6+
import jakarta.persistence.Id
67

78
@Entity
9+
@Table(name = "replaceme")
810
data class REPLACEME(
911
@Id
1012
@GeneratedValue(generator = "replaceme-sequence-generator")

contributed/requests/address.http

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
GET https://postman-echo.com/get?foo1=bar1&foo2=bar2
33

44
> {%
5-
// client.global.set("port", "4080");
6-
client.global.set("port", "8888");
5+
client.global.set("port", "4080");
6+
// client.global.set("port", "8888");
77
%}
88

99
### Login and get Bearer
@@ -48,7 +48,7 @@ Authorization: Bearer {{auth_token}}
4848
client.assert(response.status === 200, "Response status is not 200");
4949
});
5050
const body = response.body;
51-
client.global.set("test_address", body['id']);
51+
client.global.set("test_address_id", body['id']);
5252
%}
5353

5454
### Get all
@@ -63,7 +63,7 @@ Authorization: Bearer {{auth_token}}
6363
%}
6464

6565
### Get 1
66-
GET http://localhost:{{port}}/starter-test/api/v1/address/{{test_address}}
66+
GET http://localhost:{{port}}/starter-test/api/v1/address/{{test_address_id}}
6767
Content-Type: application/json
6868
Authorization: Bearer {{auth_token}}
6969

@@ -103,7 +103,7 @@ Authorization: Bearer {{auth_token}}
103103
%}
104104

105105
### Delete
106-
DELETE http://localhost:{{port}}/starter-test/api/v1/address/{{test_address}}
106+
DELETE http://localhost:{{port}}/starter-test/api/v1/address/{{test_address_id}}
107107
Authorization: Bearer {{auth_token}}
108108

109109
> {%

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.0.0-RC2</version>
8+
<version>3.0.0</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111

src/main/kotlin/osahner/config/WebConfig.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package osahner.config
33
import org.springframework.context.annotation.Bean
44
import org.springframework.context.annotation.Configuration
55
import org.springframework.http.HttpMethod
6-
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
6+
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity
77
import org.springframework.security.config.annotation.web.builders.HttpSecurity
88
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
99
import org.springframework.security.config.http.SessionCreationPolicy
@@ -18,7 +18,7 @@ import osahner.service.AppAuthenticationManager
1818

1919
@Configuration
2020
@EnableWebSecurity
21-
@EnableGlobalMethodSecurity(prePostEnabled = true)
21+
@EnableMethodSecurity(prePostEnabled = true)
2222
class WebConfig(
2323
val securityProperties: SecurityProperties,
2424
val authenticationManager: AppAuthenticationManager,
@@ -33,6 +33,7 @@ class WebConfig(
3333
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) // no sessions
3434
.and()
3535
.authorizeHttpRequests()
36+
.requestMatchers("/api/**").permitAll()
3637
.requestMatchers(HttpMethod.GET, "/actuator/health/**").permitAll()
3738
.requestMatchers(HttpMethod.GET, "/actuator/info/**").permitAll()
3839
.requestMatchers(HttpMethod.POST, "/login").permitAll()

src/test/kotlin/osahner/AuthenticationTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal class AuthenticationTest(
4747
try {
4848
restTemplate.postForEntity<Any>("/login", falseLoginForm).also {
4949
assertNotNull(it)
50-
assertEquals(HttpStatus.UNAUTHORIZED, it.statusCode)
50+
assertEquals(HttpStatus.FORBIDDEN, it.statusCode)
5151
}
5252
} catch (e: Exception) {
5353
print("Fixme RestTemplate with HttpStatus.UNAUTHORIZED result")
@@ -61,7 +61,7 @@ internal class AuthenticationTest(
6161
try {
6262
restTemplate.postForEntity<Any>("/login", falseLoginForm).also {
6363
assertNotNull(it)
64-
assertEquals(HttpStatus.UNAUTHORIZED, it.statusCode)
64+
assertEquals(HttpStatus.FORBIDDEN, it.statusCode)
6565
}
6666
} catch (e: Exception) {
6767
print("Fixme RestTemplate with HttpStatus.UNAUTHORIZED result")
@@ -75,7 +75,7 @@ internal class AuthenticationTest(
7575
try {
7676
restTemplate.postForEntity<Any>("/login", falseLoginForm).also {
7777
assertNotNull(it)
78-
assertEquals(HttpStatus.UNAUTHORIZED, it.statusCode)
78+
assertEquals(HttpStatus.FORBIDDEN, it.statusCode)
7979
}
8080
} catch (e: Exception) {
8181
print("Fixme RestTemplate with HttpStatus.UNAUTHORIZED result")

0 commit comments

Comments
 (0)