Since you cannot delete the received message, I suggest you read / vote for the Hans message, this is a much better explanation than my original: Spring Annotation Dependence
When using stereotype annotations (@Service, etc.), the trade-off for getting a companion bean check is that you join the spring-context library in your code. I see 3 immediate options:
1) Remove annotations and configure beans in XML.
2) Copy spring -context.jar (or the equivalent library with your stereotype annotations) into a non-Spring project to resolve dependencies, but leave Spring unconfigured so that it is not used in your code.
3) Remove annotations from your specific classes and extend them with Spring versions. This approach may or may not be a bit invasive for your design, but you should consider:
public class MyDAO { protected SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; }
And subclass of Spring:
@Repository public class MySpringDAO extends MyDAO { @AutoWired protected SessionFactory sessionFactory; }
Thus, your Spring project can use "MyDAO" and exclude the "MySpringDAO" class from the assembly.
seanhodges Mar 18 2018-10-18T00: 00Z
source share