This works when we create jersey project right ?
can you please explain a little on service and serviceimpl?
I want my user to press a button, and know in the backend which button was pressed?
Hi, how can I get the source code of an intermediate spring boot project to learn spring boot better?
Why don’t we rather put everything in service itself?
How to call a function (in java) from button click in html?
yes
I have three tables: users (User.class), roles(Role.class) and the relation table “users_roles”
can you please explain a little on service and serviceimpl?
Service is interface where you will define the method for which you going to write business logic
Where serviceimpl is implementation of that abstract method
Where serviceimpl is implementation of that abstract method
yes I meant why we need two.Why don’t we rather put everything in service itself?
in some examples, I find everything logic in service itself.
so I kind of confused
in some examples, I find everything logic in service itself.
so I kind of confused
You can write service logic directly taking as class but that is not good practice
In interface you can keep method that you going to use in future but you not sure about implementation at this moment
When you have to intrect with database then you must go with interface n then implementation of them
When you have to intrect with database then you must go with interface n then implementation of them
oh I now understood Thanks
Please help me
There are many advantages of using an interface: Abstraction, Composition, Loose coupling, Polymorphism, Re-usability, etc. All these are either design principles or a by-product of the OOPS concept. As Java is based on OOPS, it makes sense to implement them, wherever possible.
Composition: With composition, the inner (child) object [ServiceImpl class] lives only till the outer (parent) object lives [Service interface]. For ex., one bean of ServiceImpl may be used in several places & all that can be destroyed just by destroying it’s parent bean. (In frameworks like Spring, a central container maintains the objects & this makes it easy for the container to maintain).
Loose Coupling: This means that there is no or less dependency between the components within a project. This is a primary design principle of Java.
For ex., when you create just one service class without an interface, later if you want to add another database or change the database, you’ll have to re-write the service class.
Also, if you want to use the same service for another project or an external api, then you need to give them access to the service class (in other words, those external apis will be able to read your implementation) – which is not desirable.
If there’s an interface, you can just an additional method to handle the external apis & write a separate service class & give them access only to the interface (aka abstraction).
Polymorphism & Re–usability are a part of the above explanation itself. Try to relate it with the bean creation concept & multiple service classes concept explained above.
The places where you have seen would either be small & static projects (mostly), or if big projects, can be said to be poorly designed. For small & static projects, it only adds boiler-plate code – as there is not going to be much change. For bigger projects (esp. the ones intended to be shared across various clients) & for frameworks/libraries (like Spring, Hibernate, etc), it is both important & useful.
Composition: With composition, the inner (child) object [ServiceImpl class] lives only till the outer (parent) object lives [Service interface]. For ex., one bean of ServiceImpl may be used in several places & all that can be destroyed just by destroying it’s parent bean. (In frameworks like Spring, a central container maintains the objects & this makes it easy for the container to maintain).
Loose Coupling: This means that there is no or less dependency between the components within a project. This is a primary design principle of Java.
For ex., when you create just one service class without an interface, later if you want to add another database or change the database, you’ll have to re-write the service class.
Also, if you want to use the same service for another project or an external api, then you need to give them access to the service class (in other words, those external apis will be able to read your implementation) – which is not desirable.
If there’s an interface, you can just an additional method to handle the external apis & write a separate service class & give them access only to the interface (aka abstraction).
Polymorphism & Re–usability are a part of the above explanation itself. Try to relate it with the bean creation concept & multiple service classes concept explained above.
The places where you have seen would either be small & static projects (mostly), or if big projects, can be said to be poorly designed. For small & static projects, it only adds boiler-plate code – as there is not going to be much change. For bigger projects (esp. the ones intended to be shared across various clients) & for frameworks/libraries (like Spring, Hibernate, etc), it is both important & useful.
oh spectacular Sir.Thank you so much.Now I clearly understood
I am in 7 semester can any one help me for my placement
Give me some suggestions for java developer I know core Java SQL html css and some theory knowledge about spring boot
This video shows how to use @JsonPropertyOrder annotation provided by Jackson Library to define ordering for JSON properties.
#phcodegyan #jackson #json #springboot #jsonparser #jacksonlibrary #jacksonapi #code #programming #spring #javatutorial #jacksontutorial #jsontutorial #jsonparser
Java Jackson Library Playlist
https://www.youtube.com/playlist?list…
Parse JSON to Java Object, ArrayList & Array Using Jackson Library
https://www.youtube.com/watch?v=A8VZI…
Convert Java Object to JSON String using Jackson Library
https://www.youtube.com/watch?v=YH54o…
Jackson Library – JsonGetter & JsonSetter Annotations
Jackson Library – @JsonProperty Annotation | Defining JSON property name
https://youtu.be/0adnghiYUyo
As a fresher most of company conduct written exam n online assessment bases on that they will go for further f2f tech round so suggestions would be to clear that assessment to placed n more opportunity
I asked one but u r answer is another, i actually asked how to make shortlist our resume by companies for writing exam
Can you send me that one…
I’m totally new for spirng
Better try to search with genuine consultancy, through them it will be easier to get the calls and first round.