Spring Boot Security / Request = 500
Hello guys, I'm a beginner here who's trying Spring Boot security.
I'm trying to sign in with the httpSecurity but when I do my sign-in request, SPring boot redirects me to the famous issue.
The thing is in my security configuration I understand I have to modify this line :
But my home URL is
http://localhost:8080/
do you know how to modify the url to at least redirect it to the homepage ( I built my environment with Maven ) ?61 Replies
⌛
This post has been reserved for your question.
Hey @NoSung! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Can you show the stack trace?
Basically an exception
and this is my code at line 39 in my
index.html
:
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Can you show the full stack trace instead of a part of it?
Also for the security configuration, did you show the complete security configuration or is there more to it?
Solution: Use curly bracets instead of round bracets.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Sorry for that.
@Peter Rader found the solution, I did a stupid syntax error as he said
yeah I saw that ;)
maybe I should increase my font size lol
Do you know if there's a way to personalize the errorMessage function ?
which function exactly?
I think I should do that too, because I wasn't even aware of the slack track, I was pretty sure I had to configure my security config and not my static file lol
it isn't a static file
it's a template
Here in my Account controller :
I call the addError but the thing is on the client side, it appears in black and I would like to change the color or the font-size and I've done research to personnalize it but can't find any
Oh wait it's basically a static file because it's a template or because I'm using thymeleaf ?
static file means it's served without any modifications to it
You have thymeleaf which processes/transforms it before sending it to the client
Well, how are you reading the error in thymeleaf?
You should be able to use CSS or similar things on it
Oh I thought static files meant no dynamic code actually 🫣
?
idk how exactly thymeleaf does it but with JSP, you are essentially generating Java code dynamically IIRC
Yes but I mean the terminology of static files
let me check how I read the error in th
Essentially with Thymeleaf, you define a template and thymeleaf renders the template (idk whether it uses some intermediate representation or other internals though)
Ok thanks for the explanation, I'm still a bit confused about the whole Spring Boot environement
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
( sorry for the indentation ) I'm generating the message with the
FieldError
functionSo you are still talking about the errors displayed in a way you don't want, right?
Yes but I think I find it
I think instead of writing codes I don't understand, I need to learn the entire Spring Boot architecture from the Controller to the DTO
Yeah Spring has many things to it
I think in isolation, most are pretty understandable
but doing many at once are complicated
On the other hand, that's the big advantage - Spring provides all of these things to developers
Yes I totally agree with you, I just find the solution to my problem but I can't really modify everything ( I've figured out how to change my error messages color, but the the style etc )
I'm still confused about the DTO and the entities to me it does the same thing
Which problem? Is it the errors being displayed in a way you don't want or is it something different?
I mean I would to put other font style in the same attribute but this gives me an error ( it's the same thymeleaf attribute where I changed the color ) I tried to put an italic style but this rendered me an error
What exactly did you change and what's the exact error it resulted in?
I've changed this class in a Tailwind class
I don't think tailwind knows about Thymeleaf so adding a
th:something
in Tailwind probably isn't usefuland I've discovered that if you set the annotation with no message in the DTO, it render a default message in my native language ( whch is weird because I set the html tag in english
It does at least for the color because I was able to change the color
with a Tailwind utility class
but I don't know if it's fully compatible between Thymeleaf and Tailwind tbh
Instead of
th:errorclass="text-red-700 "
, can you try class="text-red-700"
?It doesn't render me in red anymore so I have to leave it that way
?
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
The utility class doesnt work anymore
Which utility class?
The text-red-700, it's a Tailwind class
Did you try with
class=
as well instead of just th:errorclass=
?
Does adding a custom style=
work?Yes but I want to add another class and it doesn't work, for example I'd like to add font-bold or font-italic behind the text-red but at run time it gives me an error
what error are you getting?
It could work but this means I omit Tailwind
and what's the code?
it would be good to know whether it works for debugging
Let me do this tomorrow because I'm not at home rn, I will ping you with the code you want
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
@dan1st | Daniel
in this code, as I said yesterday, I tried to add another Tailwind class to modify my element
The font-semibold is the other class I wanted to add or font-italic, in both cases and based on the Tailwind documentation it should work but as you said maybe Thymeleaf is only compatible with only one class
You still didn't specify whether it works with class instead of th:errorclass
and also not whether non-Tailwind stuff works
no it didn't as I said before
ah then I overlooked that
Does it work with non-Tailwind stuff?
no problem, I think thymeleaf doen't allow me to have more than one utlity class
because knowing that would help finding what causes the issue
I don't really think that's the case
Does the
ont-semibold
have any effect?
Also can you check the HTML sent to the client in the devtools with th:errorclass="text-red-700 font-semibold"
?it basically change your element in bold
I don't understand what you're saying, you mean checking it in the network devtool ?
almost
in the inspector
ok let me check after compile time
though the network tab should work as well
Ok so at run time I have this exception which is directly in correlation with my tailwind classes
ok yeah then you can probably not use
th:errorclass
there
but that wouldn't explain class=
not working (without a th:
)I think it's because I'm using a thymeleaf element that has a thymeleaf object as a parent
but it's ok I think, it's not a big deal
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Post Closed
This post has been closed by <@680567289241927779>.