Why do we not simply push all logics into service and rather make it as class than having as interface?

|
H Ahmadi 2022-07-09 22:26:17
springbootmicroservices-67335.jpg

H Ahmadi 2022-07-09 22:26:27
Where is the problem?
Tomaxin 2022-07-09 23:59:45
Hello! I’m new to Spring and I’m trying to make a project that at the moment does a user login with roles. When I don’t add the roles, it works perfectly. The problem is when I want to add roles to the user, through a ManyToMany relationship. I send captures of the most relevant code to see if someone can tell me where the error comes from, thanks!
Tomaxin 2022-07-10 00:00:02
springbootmicroservices-67341.jpg
User
Tomaxin 2022-07-10 00:00:08
springbootmicroservices-67342.jpg
Role
Tomaxin 2022-07-10 00:00:14
springbootmicroservices-67343.jpg
UserRepo
Tomaxin 2022-07-10 00:00:29
springbootmicroservices-67344.jpg
CustomUserDetails
Tomaxin 2022-07-10 00:00:44
springbootmicroservices-67345.jpg
CustomUserDetails
Tomaxin 2022-07-10 00:00:52
springbootmicroservices-67346.jpg
UserDao
Tomaxin 2022-07-10 00:01:03
springbootmicroservices-67347.jpg
Persistance1
Tomaxin 2022-07-10 00:01:10
springbootmicroservices-67348.jpg
Persistance2
Tomaxin 2022-07-10 00:01:31
I use email to login
Tomaxin 2022-07-10 00:02:13
And this is the error:
Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘myController’: Unsatisfied dependency expressed through field ‘userDao’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userDAOclass’: Unsatisfied dependency expressed through field ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in class path resource [es/tmarcos/PrimerProyecto/config/PersistenceConfigManagement.class]: Invocation of init method failed; nested exception is java.lang.NullPointerException: Cannot read the array length because “<local1>” is null
Jitendra bansal 2022-07-10 05:19:34
Any one know Android programming
Jitendra bansal 2022-07-10 05:20:32
H Ahmadi 2022-07-09 22:26:27
Where is the problem?

Hello tell me

Sanjay 2022-07-10 08:01:09
Any one has html css js video s
S!D 2022-07-10 08:29:40
Spring mvc don’t support json?
ForUrEyesOnly 2022-07-10 08:36:18
S!D 2022-07-10 08:29:40
Spring mvc don’t support json?

It supports

v_lan1337 2022-07-10 09:05:56
Tomaxin 2022-07-09 23:59:45
Hello! I’m new to Spring and I’m trying to make a project that at the moment does a user login with roles. When I don’t add the roles, it works perfectly. The problem is when I want to add roles to the user, through a ManyToMany relationship. I send captures of the most relevant code to see if someone can tell me where the error comes from, thanks!

User roles table name seems to be different at diff. places.

S!D 2022-07-10 09:28:07
ForUrEyesOnly 2022-07-10 08:36:18
It supports

But we can’t convert form data directly to json in spring mvc right?

ForUrEyesOnly 2022-07-10 09:30:52
S!D 2022-07-10 09:28:07
But we can’t convert form data directly to json in spring mvc right?

I am not unable to recall but there is some interface or something which convert objects to json format

v_lan1337 2022-07-10 09:40:32
S!D 2022-07-10 09:28:07
But we can’t convert form data directly to json in spring mvc right?

If you’re asking about sending/receiving json formatted values from/to REST services in MVC, you can use the annotaitons: @Produces({application/json}) or @Consumes({application/json}) on the GET/POST methods, respectively.

If you’re asking about consuming json from the MVC services (i.e. converting/mapping the json output to Java objects), you can use libraries like Jackson.

MrStaudinger 2022-07-10 10:12:19
Hi there,

I am using spring boot thymeleaf to create a webapp, and need to add 2 button’s with functionalities for “shut-down” and “restart”, from the html button itself.

How can we design this?

S!D 2022-07-10 10:19:24
v_lan1337 2022-07-10 09:40:32
If you’re asking about sending/receiving json formatted values from/to REST services in MVC, you can use the annotaitons: @Produces({application/json}) or @Consumes({application/json}) on the GET/POST methods, respectively.

If you’re asking about consuming json from the MVC services (i.e. converting/mapping the json output to Java objects), you can use libraries like Jackson.

Spring mvc as consumer and spring rest as provider so I think producer and consumer annotations will help, will try. Thanks

S!D 2022-07-10 10:20:12
Let’s say if we will be not using producer and consumer annotations in that case first we have to convert form data to model object then model object to json data right
i aspirant 2022-07-10 10:20:19
hi friends, I am new to springboot.
we use service and serviceImpl both.

Why do we use service as as an interface..as far my knowledge, it provides methods signature which the implementing classes need to implement…thereby providing contract for the unrelated classes..In examples, I saw serviceimpl class which overrides a single method..

What for instance, if we like to add more methods in the interface later.Why do we not simply push all logics into service and rather make it as class than having as interface? plz if any help to guide

v_lan1337 2022-07-10 10:32:08
S!D 2022-07-10 10:20:12
Let’s say if we will be not using producer and consumer annotations in that case first we have to convert form data to model object then model object to json data right

yes

S!D 2022-07-10 10:33:05
Ok great
S!D 2022-07-10 10:33:09
Thanks
Moises Henriques 2022-07-10 10:37:18
v_lan1337 2022-07-10 09:40:32
If you’re asking about sending/receiving json formatted values from/to REST services in MVC, you can use the annotaitons: @Produces({application/json}) or @Consumes({application/json}) on the GET/POST methods, respectively.

If you’re asking about consuming json from the MVC services (i.e. converting/mapping the json output to Java objects), you can use libraries like Jackson.

This works when we create jersey project right ?

|