Slackbot
06/10/2022, 10:21 PMdany giguere
06/13/2022, 9:27 PMstateless
authentication. The front end will be an SPA. Anyone knows an easy tutorial that could help me ?
I’ve tried many ones but it was too complicated for a spring boot rookie like me.João Gabriel Zó
06/16/2022, 4:57 PMVáclav Škorpil
06/21/2022, 12:01 PMsreich
06/21/2022, 8:30 PMsreich
06/22/2022, 5:22 PMClass 'CmcSbsbSubsc' should have [public, protected] no-arg constructor
this doesn't seem to be a compiler issue though...it compiles fine through maven. Does this mean this intention is wrong because we are doing noarg at annotation time? and i should tell IDEA to ignore that warning on the class name?
@Entity
@Table(name = "CMC_SBSB_SUBSC", schema = "FACETCOR")
data class CmcSbsbSubsc(
@Id
@Column(name = "SBSB_CK", nullable = false)
val sbsbCk: Long,
@Column(name = "SBSB_ID", nullable = false)
val sbsbId: String
)
sreich
06/28/2022, 6:13 PM@Embeddable
to get it to work. hopefully that doesn't interfere
@EqualsAndHashCode
class CmcMepePrcsEligId(
val memeCk: Long,
val cspdCat: String
) : Serializable {
companion object {
private const val serialVersionUID = 1L
}
}
sreich
06/28/2022, 6:33 PMsdeleuze
07/01/2022, 1:08 PMantonarhipov
07/06/2022, 10:50 AMsreich
07/07/2022, 3:51 PMmp
07/13/2022, 12:57 PMNo default constructor found; nested exception is java.lang.NoSuchMethodException
on configuration class loading(with sb 2.6 and 2.7) that have been properly loaded(with SB 2.5) with constructor injection
have I missed some important about bean configuration process updates?George
07/17/2022, 12:34 PMfinishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80
org.springframework.web.reactive.function.client.WebClientRequestException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80
from a rather simple springboot-kotlin code. Has anyone encountered this? Thanks in advance 🙂sdeleuze
07/19/2022, 1:46 PMkubele
07/26/2022, 8:40 PMspring-boot-starter-data-cassandra-reactive
and CoroutineCrudRepository
? I’m quite struggling with using reading user-defined type (UDT), writing to the table works fine.
Sample repo hereMarian Schubert
07/29/2022, 9:42 AM@Transactional
) in following code:
class MyBoolean(var value: Boolean) {
fun get(): Boolean = value
}
abstract class Foo {
private val _hasError = MyBoolean(false) // <- line 16
val hasError: Boolean get() = _hasError.get()
}
@Component
class MyFoo : Foo() {
@Transactional
fun doFoo() {
}
}
class FooTest : SpringTest() {
@Autowired
lateinit var foo: MyFoo
@Test
fun `is null`() {
assertThat(foo.hasError).isFalse // <- line 33
foo.doFoo()
}
}
code/test above throws exception
java.lang.NullPointerException: Cannot invoke "com.bitsafe.behi.admin.projections.MyBoolean.get()" because "this._hasError" is null
at Foo.getHasError(FooTest.kt:16)
at <http://FooTest.is|FooTest.is> null(FooTest.kt:33)
which doesn't make sense as _hasError
should never be null
? If I remove @Transactional
from doFoo
method everything works as expected. What's going on?
BTW problem also disappears if I put stuff from abstract class Foo
directly into class MyFoo
(which I don't want).Siddhartha Juluru
08/13/2022, 2:23 AM@Entity
class Test(@field:NonNull val param: String)
or do I have to do
@Entity
class Test(@field:NonNull val param: String?)
Mikhail
08/18/2022, 1:14 PMArjan van Wieringen
08/19/2022, 8:06 AMfromDataEntity
and toDataEntity
helper functions for every common data class which is to be persisted. But that is a lot of boilerplate I suppose.
Any other ideas?Arjan van Wieringen
08/19/2022, 9:51 AMRepositoryRestResource
not work with UUID
? I am getting "EntityRepresentationModel not found!":
I have a very simple Entity and Repository:
@Entity()
class Account(
@Id var id: UUID,
var name: String
)
@RepositoryRestResource(path="accounts", collectionResourceRel = "accounts")
interface AccountRepository : CrudRepository<Account, UUID> {
}
@Bean
fun initializeDatabase(accountRepository: AccountRepository) = ApplicationRunner {
accountRepository.save(Account(id = UUID.randomUUID(), name = "Test"))
<http://logger.info|logger.info>("Initialized test data")
}
And when I run the application I get a nice HATEOS response:
{
"_embedded": {
"accounts": [
{
"name": "Test",
"_links": {
"self": {
"href": "<http://localhost:8080/accounts/4c12f420-6189-4abd-a970-573ba2e0ca23>"
},
"account": {
"href": "<http://localhost:8080/accounts/4c12f420-6189-4abd-a970-573ba2e0ca23>"
}
}
}
]
},
"_links": {
"self": {
"href": "<http://localhost:8080/accounts>"
},
"profile": {
"href": "<http://localhost:8080/profile/accounts>"
}
}
}
But when I go to that URL I get a 404 and an error in the console saying:
Resolved [org.springframework.data.rest.webmvc.ResourceNotFoundException: EntityRepresentationModel not found!]
It works with a Long as ID. So that is confusing.
EDIT: I need to add @Column(columnDefinition = "BINARY(16)")
to the entity ID.Leonardo Borges
08/25/2022, 9:20 AM@Transactional
work using suspend
functions? (using sql db)Davio
08/26/2022, 6:56 AM<option>all-open:annotation=org.springframework.boot.context.properties.ConfigurationProperties</option>
Slackbot
08/27/2022, 3:05 PMGeorge
08/30/2022, 12:53 PMPayload content is missing
if try to add @Payload annotation with @connectMapping. Per my understading from docs: quote connectMapping this should work (i guess) (Snippet in thread). Thanks for any answers ins advance !Thomas Dziedzic
09/11/2022, 1:48 PMdany giguere
09/12/2022, 12:07 PM@GetMapping("/slow-service-users")
fun getAllUsers(): List<User?>? {
Thread.sleep(2000L) // delay
return userRepository.findAll()
}
@GetMapping(value = ["/users-non-blocking"])
fun getUsersNonBlocking(): Flux<User?>? {
<http://logger.info|logger.info>("Starting NON-BLOCKING Controller!")
val userFlux: Flux<User?> = WebClient.create()
.get()
.uri("<http://localhost:8080/slow-service-users>")
.retrieve()
.bodyToFlux(User::class.java)
userFlux.subscribe { user -> <http://logger.info|logger.info>(user.toString()) }
<http://logger.info|logger.info>("Exiting NON-BLOCKING Controller!")
return userFlux
}
/slow-service-users
returns a proper response. But when I call /users-non-blocking
, I get this error:
"org.springframework.web.reactive.function.client.WebClientResponseException: 200 OK from GET <http://localhost:8080/slow-service-users>; nested exception is org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/json' not supported for bodyType=com.example.app.models.User
How can I fix this Content type 'application/json' not supported for bodyType
error ? The project repo is here: https://github.com/danygiguere/springboot-kotlin-example.
The user model is:
@Entity
class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
var id: Long? = null
var username = ""
@Column(unique = true)
var email = ""
var password = ""
@JsonIgnore
get() = field
set(value) {
val passwordEncoder = BCryptPasswordEncoder()
field = passwordEncoder.encode(value)
}
fun comparePassword(password: String): Boolean {
return BCryptPasswordEncoder().matches(password, this.password)
}
val firstName: String = ""
val lastName: String = ""
@JsonManagedReference
@OneToMany(cascade = [(CascadeType.ALL)], orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "userId", referencedColumnName = "id")
var posts: List<Post>? = null
}
dany giguere
09/16/2022, 8:47 PMmplementation("org.springframework.boot:spring-boot-starter-webflux:2.7.3")
implementation("org.springframework.boot:spring-boot-starter-data-r2dbc")
implementation("org.springframework.data:spring-data-r2dbc:1.5.2")
implementation("io.r2dbc:r2dbc-spi:1.0.0.M6")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
Anyone can see what I’m missing ?dany giguere
09/21/2022, 6:53 PMrestTemplate.exchange(uri, <http://HttpMethod.POST|HttpMethod.POST>, request, Response.class);
the problem is that the response is an array that contains an object. How could I make the Response class to return an array ? I tried doing:
restTemplate.exchange(uri, <http://HttpMethod.POST|HttpMethod.POST>, request, ArrayList<Response>.class);
(then I would not need to return the class as an array) But I can only do ArrayList.class
. It won’t take the <>
sreich
09/21/2022, 8:23 PMjakarta.annotation-api
.Generated on a low jdk version? (8) ?Michael Böiers
09/23/2022, 2:05 PM@Service
with a method that declares default parameter values and then call the service from another @Component
not supplying a value, there is a NoSuchMethodError thrown. Apparently Spring creates a (Java) proxy for the service which does not support default parameter values (not supported in Java).
Is there a solution for this problem?Michael Böiers
09/23/2022, 2:05 PM@Service
with a method that declares default parameter values and then call the service from another @Component
not supplying a value, there is a NoSuchMethodError thrown. Apparently Spring creates a (Java) proxy for the service which does not support default parameter values (not supported in Java).
Is there a solution for this problem?Robert Jaros
09/23/2022, 2:43 PM@Service
annotated components with methods with default parameters without problems.Michael Böiers
09/23/2022, 2:50 PMBen
09/23/2022, 2:52 PMcode compiles and then fails at runtimeThat is the major downside of using a framework like spring where it builds the dependency graph at runtime.
Michael Böiers
09/23/2022, 3:53 PMThomas
09/26/2022, 8:42 AMwakingrufus
09/28/2022, 4:07 AMcorneil
09/29/2022, 5:02 PMwakingrufus
09/29/2022, 5:08 PMMichael Böiers
09/29/2022, 5:29 PMcorneil
09/29/2022, 5:33 PMMichael Böiers
09/29/2022, 5:34 PMcorneil
09/29/2022, 5:36 PMwakingrufus
09/29/2022, 5:39 PMMichael Böiers
09/29/2022, 6:06 PM