我有一个bean Item<T>需要在@Configuration课堂上自动装配.
@Configuration
public class AppConfig {
@Bean
public Item<String> stringItem() {
return new StringItem();
}
@Bean
public Item<Integer> integerItem() {
return new IntegerItem();
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试时@Autowire Item<String>,我得到以下异常.
"No qualifying bean of type [Item] is defined: expected single matching bean but found 2: stringItem, integerItem"
Run Code Online (Sandbox Code Playgroud)
我应该如何Item<T>在Spring中自动加载通用类型?
When i update my java I found the issue "Project facet Java version 1.7 is not supported" To resolve this issue follow the steps.

如何在solr中编写嵌套的schema.xml
schema.xml中的文档说
<!-- points to the root document of a block of nested documents. Required for nested
document support, may be removed otherwise
-->
<field name="_root_" type="string" indexed="true" stored="false"/>
Run Code Online (Sandbox Code Playgroud)
哪个可以使用
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
什么是schema.xml用于嵌套以下项目:
我有一个Spring MVC REST服务,应该接收混合的mime内容.控制器定义为
@POST
@Path("/createMime")
@Consumes("multipart/mixed")
@ResponseStatus(HttpStatus.OK)
public String createMime(@Context ServletContext servletContext, MultipartInput input) throws MyRestException {
logger.info("Processing /createMime");
return "TEST";
}
Run Code Online (Sandbox Code Playgroud)
当我测试上面我得到以下错误:
17:18:58,456 WARN [org.jboss.resteasy.core.SynchronousDispatcher] (http--127.0.0.1-8080-1) Failed executing POST services/createMime: org.jboss.resteasy.spi.UnsupportedMediaTypeException: Cannot consume content type
at org.jboss.resteasy.core.registry.Segment.match(Segment.java:112) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.registry.SimpleSegment.matchSimple(SimpleSegment.java:33) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.registry.RootSegment.matchChildren(RootSegment.java:327) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.registry.SimpleSegment.matchSimple(SimpleSegment.java:44) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.registry.RootSegment.matchChildren(RootSegment.java:327) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:374) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:367) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:251) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:173) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:118) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.2.1.GA.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) …Run Code Online (Sandbox Code Playgroud) 虽然tools.jar它不是 JRE 中的一个组件,但它附带了 JDK 的所有主要实现,例如 Oracle JDK 和 OpenJDK。
不是 JRE 的标准组件意味着当我分发使用 的 Java 应用程序时tools.jar,我必须将它与应用程序包一起分发或将其包含在类路径中。
我的问题是:
tools.jar,但是 OpenJDK 呢,我们可以从 OpenJDK 分发 tools.jar 以避免许可问题吗?我是AspectJ和Maven的新手.
我正在尝试使用aspectj-maven-plugin来构建我的项目,但它不起作用.我只是按照AspectJ In Action 2 nd Edition中的步骤进行操作.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
这是我<execution>在线上的错误消息:
生命周期配置未涵盖的插件执行:org.codehaus.mojo:aspectj-maven-plugin:1.4:compile(执行:默认,阶段:编译)
我正在使用JDK6和Apache Maven 3.0.4.
我是 sms lib api 的新手,我以前从未使用过 api,请你给我一些帮助,如何从头到尾使用它在 eclipse 中使用 Gsm 调制解调器发送和接收短信。请这是紧急情况,我的最后一年的项目基于它。请这将是一个很大的帮助..提前谢谢