What is a JavaBean exactly?

A JavaBean is just a standard All properties are private (use getters/setters) A public no-argument constructor Implements Serializable. That’s it. It’s just a convention. Lots of libraries depend on it though. With respect to Serializable, from the API documentation: Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not … Read more

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘demoRestController’

Your DemoApplication class is in the com.ag.digital.demo.boot package and your LoginBean class is in the com.ag.digital.demo.bean package. By default components (classes annotated with @Component) are found if they are in the same package or a sub-package of your main application class DemoApplication. This means that LoginBean isn’t being found so dependency injection fails. There are a couple of ways to solve your problem: Move LoginBean into com.ag.digital.demo.boot or a sub-package. Configure … Read more

Is spring default scope singleton or not?

Spring’s default scope is singleton. It’s just that your idea of what it means to be a singleton doesn’t match how Spring defines singletons. If you tell Spring to make two separate beans with different ids and the same class, then you get two separate beans, each with singleton scope. All singleton scope means is that when … Read more