我有一个简单的应用程序,其中包含xml配置,1弹簧会话bean,控制器。使用注解一切正常,但是看起来spring看不到xml配置,因为它找不到Person bean?!
问题是我如何才能仅通过xml自动布线bean?
异常消息:
No qualifying bean of type 'com.spring_beans_scope.beans.Person' available: expected at least 1 bean which qualifies as autowire candidate
<beans xmlns="http://www.spring
我有一个使用注释的大型spring应用程序,它在spring 4.3.13中运行良好,并且希望更新到spring 5。
Unsatisfied dependency expressed through field 'pcoDAO'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.acme.dao.impl.contracts.PotentialChangeOrderDAO' a
如果用已验证的注释对服务类进行注释,那么同一个类就不能自动更新自己。
@Service
@Validated
public class SomeService {
@Autowired
private SomeService someService;
}
这是在Spring上下文试图加载时引发的异常:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'someService' defined in file [/home
我无法找到以下简单场景失败的原因:我有一个带有过滤器的Spring应用程序,它从应用程序上下文中加载Spring:
public class MyFilter implements Filter{
private IPermissionService permissionService;
public void init(FilterConfig filterConfig) throws ServletException {
WebApplicationContext ac = null;
try{
ac = WebA
我正在尝试创建一个基于注解的Spring MVC项目。它可以正确编译,但在部署时抛出错误
11:00:24,788 WARN [org.jboss.as.ee] (MSC service thread 1-5) JBAS011006: Not installing optional component org.springframework.http.server.ServletServerHttpAsyncRequestControl due to an exception (enable DEBUG log level to see the cause)
11:00:24,788 WAR
我无法通过模拟UserService.save()方法来返回虚拟用户对象来测试我的控制器类。
继续获得以下异常
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springf
我收到以下错误:
Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'factoryBO': Unsatisfied dependency expressed through field 'cleanupProvider': No qualifying bean of type [com.spring.factory.interfaces.impl.Cl
我正在使用JDK1.7,intelliJ社区13,我正在编写一个spring JUnit测试:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:test-applicationContext.xml"})
public class InstructionMessageTest {
@Autowired
@Qualifier("validator")
public Validator validator;
我有一个person模型类,它需要是不可变的和单例的。我需要从我的服务类自动连接,但得到一个错误。
那么有没有办法在spring boot中创建一个单例不可变的类呢?在那里我可以亲自设置值(通过自动配线),并在整个应用程序中使用相同的值。
我刚刚开始学习spring-boot。我在谷歌上搜索,用Lombok找到了解决方案,但不知何故它对我不起作用。
我的person模型:
@Value
@Builder
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Component
public final c
我有两个Spring Beans如下所示:
@Service
public class A{
}
@Service
public class B{
@Autowired A a;
public B(){
a.doSomething();
}
问题是A不一定会比B更早初始化,所以我会在B()中得到一个NullPointerException。
有没有办法让我在Spring中指定这个依赖?
我正在尝试动态注册作业/触发器。情况是,我有数据库,它有所有的作业配置,比如作业开始时间。所以我试着在运行时注册这个作业。每当我运行注册作业时,它都会给出以下异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactoryBean' defined in class path resource [com/hello/QuartzFactory.class]: Invocation of init method failed; ne
我正在为SOAP web服务构建一个新项目。之前,我使用JDBC层打开和关闭连接。现在,我正在使用JDBC模板将其转换为Spring。我已经配置了所有的层,并对组件进行了注释。当我试图在我的服务impl类中使用to bean时,它抛出了null指针异常。
@Service
@WebService
public interface Transaction { // Web methods here for SOAP Web service
}
Impl类
@Component
@WebService
public class TransactionImpl implements Transact
我使用Spring,使用@Autowired注释有很多困难。编译后,它会抛出这些错误,,编辑,,我使用普通的java类来编写类。这不是造成问题的原因,对吗?
Aug 12, 2013 2:40:32 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Aug 12, 2013 2:40:32 PM org.apache.catalina.core.ApplicationContext log
INFO: I