|
Programming › Re: Please Help, @requestparam(required=false) Not Working by InteliJ(op): 7:36pm On Sep 15, 2023 |
richebony: From the stack trace your error seems to be coming from the productService class and the updateProduct method, seems you are trying to unbox a Double to its primitive value when it is apparently null ...
What is the code snippet in line 86 of your ProductService?
Apparently, you can make a null check before that line
if(weight!=null) { //Perform business logic } Done sir! Thank you very much for your time. I'll go ahead and look for how I can implement this: place all those request params asides the id inside the request body wrapped around a dto |
Programming › Re: Please Help, @requestparam(required=false) Not Working by InteliJ(op): 2:47pm On Sep 15, 2023 |
Sorry, I was saying bs all this while. I tried to run the program today and it threw an exception - NullPointerException.
I apologise for the confusion I caused you.
Below is the screenshot of the terminal.
|
Programming › Re: Please Help, @requestparam(required=false) Not Working by InteliJ(op): 5:15am On Sep 14, 2023 |
richebony: yea, iits not supposed to act like that, that's why I asked what the class of the exception being thrown is , if it's an IllegalStateException then the error must have been thrown from the service layer and propagated to the controller class When I run the application, in the ide terminal, I get the sql command with the parameters ending with question mark. For example: When I run the putmapping method, the parameters I didn't provide a value to, gets a question mark at the end. Like so: Price? Age? I'm not on my system right now, when I charge it I'll take a picture of the terminal so you can understand what I'm saying better. |
Programming › Re: Please Help, @requestparam(required=false) Not Working by InteliJ(op): 5:35pm On Sep 13, 2023 |
richebony: What is the class of the exception being thrown
And besides why dont you place all those request params asides the id inside the request body wrapped around a dto In response to your second question: Boss, no vex I never reach that level o, I'll have to research on how to do it. The code I wrote is what I saw in the tutorial used to learn. I intend to learn more and improve tho. Thanks for taking the time to respond. I appreciate |
Programming › Re: Please Help, @requestparam(required=false) Not Working by InteliJ(op): 5:32pm On Sep 13, 2023 |
richebony: What is the class of the exception being thrown
And besides why dont you place all those request params asides the id inside the request body wrapped around a dto If I get your question right. The code is working, no exception is thrown in the terminal. The issue is that all parameters must be used. Or else, I get an internal server error in postman. Despite the fact that I set all requestparams required to false |
|
Programming › Re: Please Help, @requestparam(required=false) Not Working by InteliJ(op): 3:19am On Sep 12, 2023 |
Please ignore the emoji in the code, I think that's how nairaland was built. |
Programming › Please Help, @requestparam(required=false) Not Working by InteliJ(op): 3:17am On Sep 12, 2023 |
Please help me look at this code. I've been trying to debug this for over 2 hours now. When I test the endpoint using postman, all parameters must be provided or else it gives a "Status 500, Internal Server Error" despite the fact that I've set required=false. If I provide all parameters, it works tho. The use case of this method won't require all parameters to be provided sometimes, so I'm worried about this. Here's the code: Controller class: @PutMapping(path = "allproducts/{productId}"  public void updateProduct(@PathVariable("productId"  Long productId, @RequestParam(required = false) String name, @RequestParam(required = false) String description, @RequestParam(required = false) int quantity, @RequestParam(required = false) Double weight, @RequestParam(required = false) Double price) { productService.updateProduct(productId, name, description, quantity, weight, price); } Service class: @Transactional public void updateStudent(Long studentId, String name, String email) { Student student = studentRepository.findById(studentId) .orElseThrow(() -> new IllegalStateException( "student with id " + studentId + " does not exists"  ); if (name != null && name.length() > 0 && !Objects.equals(student.getName(), name)) { student.setName(name); } if (email != null && email.length() > 0 && !Objects.equals(student.getEmail(), email)) { Optional<Student> studentOptional = studentRepository.findStudentByEmail(email); if (studentOptional.isPresent()) { throw new IllegalStateException("Email is taken"  ; } student.setEmail(email); } } Thank you for your time |
Programming › Re: Google Oauth With Spring Boot Security by InteliJ(f): 2:57am On Sep 11, 2023 |
jesmond3945: you better read the docs. Thats where most of these videos lift from. I'll read the docs for sure. But I'm just starting, I want to get the basics from videos before I move to the docs. Thank you for the heads up. |
Programming › Re: Google Oauth With Spring Boot Security by InteliJ(f): 2:54am On Sep 11, 2023 |
|
Programming › Re: Google Oauth With Spring Boot Security by InteliJ(f): 2:52am On Sep 11, 2023 |
richebony: Lol, you are not alone in this, I also had this issue, especially with the introduction of Spring Security 6, it made most of my prior knowledge deprecated, I would recommend Dan Vega's Spring Security course on YouTube, he works with the Spring team and gets most of his resources directly from the docs .So just search for his channel on YouTube [Dan Vega]..if you have any questions u can holla Thank you very much! Sure, I will. |
|
|
Programming › Re: Google Oauth With Spring Boot Security by InteliJ(f): 3:17am On Sep 10, 2023 |
richebony: you need this dependency in your maven pom
dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-oauth2-client</artifactId> </dependency>
in your applications.properties add these
#GOOGLE OAUTH
# You need additional settings to configure your OAUTH service ..just check youtube spring.security.oauth2.client.registration.google.client-id= your-client-id spring.security.oauth2.client.registration.google.client-secret=your-secret
in your SecurityConfig class
@Configuration public class SecurityConfig {
@Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { return httpSecurity.authorizeHttpRequests(auth -> auth.requestMatchers("/" .permitAll() .anyRequest().authenticated()) .oauth2Login(Customizer.withDefaults()) .formLogin(Customizer.withDefaults()) // u can replace this with httpBasic and configure the URL .build(); } } Hello richebony, I've been learning spring security on youtube but most tutorials I've watched are not explanatory enough. It always look like they're doing magic, some are oudated especially implementing basic auth, the way to do this as shown in the tutorials is depreciated. If you don't mind, could you please recommend a good spring security video you know? Thank you. I see that you're good with this stuff, could you please mentor me? I need some guidance as this whole stuff is broad and I don't want to go the wrong way. I promise not to waste your time or stress you. Thank you! |
Politics › Re: Obidients How Far ��� by InteliJ(f): 6:49pm On Sep 06, 2023 |
Belafonte: Not true. Judgements are always positive and negative True that. But this is Nigeria.. |
Politics › Re: Obidients How Far ��� by InteliJ(f): 5:37pm On Sep 06, 2023 |
Belafonte: Never begin celebrate o. Supreme court still dey dia :  There's nth positive that'll happen at the Supreme Court |
Politics › Re: Obidients How Far ��� by InteliJ(f): 5:26pm On Sep 06, 2023 |
|
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 7:20pm On Sep 04, 2023 |
john1101: The fraudsters have a long way to go before thinking of computer programming they have to realise first their crimes, pay their penance, that will put their mindframe in order. That's what I'm saying: They should "pay their penance" first |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 7:06pm On Sep 04, 2023 |
john1101: They probably think programming is easy to learn. They don't know! |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 6:48pm On Sep 04, 2023 |
KrazyDave16: As if the country doesn't have enough negativity around it, this guy wants to add more by teaching fraudsters!?
What happened to those with the skills?
With him being quite popular, he should have channeled the energy he wants to use to "reform" fraudsters to actually getting people who are struggling to showcase their skills to others, and put the country in a good light, but noo, baba woke up with intent to further tarnish the image of this country for some selfish gain.
The fraudsters I have around me, whenever they show interest in this field, it's to see if there are softwares they could use to carry out their nefarious activities, not because they want to earn "tech money", but because they don't want to spend money buying em, and even the ones claiming to be serious stops doing it.
He should perish the idea if he's adamant on trying to reform fraudsters and stick to his Chess izh. Thank you! Fraud affects the mindset a lot |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 6:46pm On Sep 04, 2023 |
Paystack: Someone like you can never run a successful business or anything else.
As if you're a perfect being or void of crime
Many Yahoo boys today are young boy's usually carried away by social pressure and things they see
If someone is able to guide them and help them nurture their skills to good use then the country will be a better place.
It will be far better than allowing them to scam all their lives
Yes! Some people can scam without getting caught their entire lives... Karma sometimes is bullshit... u can see that from your leaders who have been scamming u their whole tenure.
This thing they're doing even if it won't make some who enroll change their ways... they're sure going to save some people and help them change and that's what matters
If out of 100 , 30 change
Then your old grandma at home has 30 less Yahoo boys to worry about calling her and tricking her into sending her bank private details Okay sir, thanks for letting us your opinion. Well appreciated. |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 5:47pm On Sep 04, 2023 |
lastkingsman: They won rehabilitate oluwadollars and Arabmoney them   |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 5:46pm On Sep 04, 2023 |
airsaylongcome: It should be a good idea to give them a pathway to legitimate earning. But I know my countrymen. They will just use "Tech worker" as the façade for there Yahoo work. Best to pick 50 struggling tech folks that have not tasted Yahoo, they are more likely to feel the impact than 50 yahoo boys who have tasted "free" dirty money.
Who knows sef, this so-called training could be Yahoo training school cloaking You just said it all! I think the convener wants to benefit from the ministry of information plan to equip 1million people with tech skills. He's doing well with his chess in slums outreach but this particular outreach doesn't make sense. Funny thing is that iyin aboyeji is in support of this like when he was the cofounder of flutterwave he will employ an ex convict or a former fraudster to work for his company. Crime has consequences, as a country we should let that be in our subconscious mind. This country is like this because we have showed in the past that crime pays and its lucrative |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 5:39pm On Sep 04, 2023 |
tensazangetsu20: Nonsense what happened to the struggling tech boys In Nigeria even here on nairaland. It's why I hate Nigeria so much. We empower nonsense That's the problem with our country. We're always doing the right thing the wrong way. Why empower fraud boys from a poor background when there're other struggling boys living in that same trenches working menial jobs? Empower genuine people for bleeps sake, stop giving people the impression that crime pays. Now watch how young boys, trying to get enrolled in start doing fraud. So, they can qualify for the programme. It's the same way people are joining boko haram or militancy because afterall govt will reward them |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 3:24pm On Sep 04, 2023 |
spinna: There are others more deserving Exactly my thoughts |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 3:23pm On Sep 04, 2023 |
22o62021: During campaign
It is among one of the things Tinubu promised us when he came to Edo state.
If them go dey send $100 gift card weekly.
I will join Lmao  No one is giving you $100 oo |
Programming › Re: Jesus!!!! No Nigerian Dev Can Build This Type Of Website by InteliJ(f): 1:44pm On Sep 04, 2023 |
tensazangetsu20: There's devs that specialise in such creative websites. Check out this portfolio seyi dot dev. That seyi on twitter right? That guy is too good. He has a designer too on his team. Mad talents |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 1:33pm On Sep 04, 2023 |
Jashub: Una wan make dem hack NASA abi....? I don't even know. People from poor backgrounds are struggling genuinely and you're deciding to reward criminals. We haven't learnt from the recent chicken Republic saga obviously. You don't reward bad behaviour with good |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 1:31pm On Sep 04, 2023 |
Feel free to say what you think about this |
Programming › Re: Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 1:30pm On Sep 04, 2023 |
Personally, I think it's not a very good move for the industry. We're still trying to fight the bad stereotype the global world has against us and now, you're bringing actual fraudsters to the industry and making it public.
People are watching, foreign companies are watching, employers are watching.
May lessons not be learnt in the future. |
Programming › Yahoo To Tech Pipeline: A Good Or Bad Move For The Nigerian Tech Industry? by InteliJ(op): 1:26pm On Sep 04, 2023 |
I was scrolling twitter this morning and I stumbled on this.
What's your thoughts? Is it a good move or a bad one and why do you think so.
Let's discuss
|