0
簡單基本獲取api並獲取字符串數據工作正常。後來我增強了該類的自動裝載依賴項,我收到一個錯誤。缺少依賴關係
2017-06-19 15:41:44.311 INFO 7808 --- [ main] c.s.j.api.core.PackagesResourceConfig : Scanning for root resource and provider classes in the packages:
com.praveen.praveen
2017-06-19 15:41:44.352 INFO 7808 --- [ main] c.s.j.api.core.ScanningResourceConfig : Root resource classes found:
class com.praveen.praveen.api.ApiResource
2017-06-19 15:41:44.353 INFO 7808 --- [ main] c.s.j.api.core.ScanningResourceConfig : No provider classes found.
2017-06-19 15:41:44.450 INFO 7808 --- [ main] c.s.j.s.s.c.servlet.SpringServlet : Using default applicationContext
2017-06-19 15:41:44.459 INFO 7808 --- [ main] com.sun.jersey.spi.inject.Errors : The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for constructor public com.praveen.praveen.api.TreesApiResource(com.praveen.praveen.support.serialization.ToApiJsonSerializer) at parameter index 0
2017-06-19 15:41:45.084 ERROR 7808 --- [ main] c.s.j.s.s.c.servlet.SpringServlet : Exception occurred when intialization
com.sun.jersey.spi.inject.Errors$ErrorMessagesException: null
我springbean.xml
<context:exclude-filter expression="org.springframework.stereotype.Controller"
type="annotation" />
<context:exclude-filter
expression="org.springframework.context.annotation.Configuration"
type="annotation" />
</context:component-scan>
public interface ToApiJsonSerializer<T> {
}
@Component
public class DefaultSerialization<T> implements ToApiJsonSerializer<T>{
private final GoogleGsonSerializerHelper helper;
@Autowired
public DefaultToApiJsonSerializer(
final GoogleGsonSerializerHelper helper) {
this.helper = helper;
}
}
@Service
public final class GoogleGsonSerializerHelper {
}
ToApiJsonSerializer是Spring Bean嗎? – Strelok