#1. Adding the @Named annotation to the interface instead of the implementation Adding the @Named, @Component, @Repository, etc annotation on the interface as opposed to the implementation class. The code below can throw “NoSuchBeanDefinitionException”
|
|
package com.mytutorial; @Named public interface SimpleDao { abstract String getNameById(int id); } |
|
|
package com.mytutorial; import javax.inject.Named; public class SimpleDaoImpl implements SimpleDao { public String getNameById(int id) { return "test" } } |
FIX: The @Named annotation is now in the implementation class. … Read more ›...