#@Bean not working -- Spring
1 messages · Page 1 of 1 (latest)
<@&1004656351647117403> please have a look, thanks.
You can use </chatgpt:1108714622413963314> to ask ChatGPT about your question while you wait for a human to respond.
What does it say lower in the stacktrace?
and complains about bean
This is where that method is being initialized. not sure why it's expecting 1 argument
The method name is findBySkuCode() so you have to provide this SkuCode thing
Thats just a syntax error
I wonder why it does not underline that
Thats where the method gets invoked not initialized 
my bad, initialized here
Oh it does really not expect an argument 
yeah
Bad naming
Actually it does expect an argument implicitly.
It does expect an argument it can automatically bind for you to SkuCode, hence the error.
I tried changing the name and am getting a different error (ig?)
I'm on the chit chat channel. Would you guys be able to join and help me out w this?
Sorry, I'm knackered. But you need to follow the patterns defined at: https://docs.spring.io/spring-data/jpa/reference/jpa/query-methods.html
Given you're expecting an Optional<Inventory> Spring Data does need to know how to reduce it from your full Inventory
So if you have findBySkuCode you would need to use findBySkuCode(String skuCode)
Oh now i get it, forgot that this is a thing. Never really touched my repositories ever again lmao
As you can see in your isInStock method in your InventoryService you're not actually passing your skuCode along (hence it being grayed out)
got it
passed in the skuCode and works like a charm
Thanks @tropic pawn, @rare axle
You're welcome.