我在应用程序上下文xml中有以下映射bean定义,并在控制器中使用了映射,这导致了spring boot 2.1.3升级的BeanDefinitionParsingException
。它在2.0.6版本中运行良好。
有人知道如何解决这个问题吗?
@SpringBootApplication
@PropertySource("classpath:app.properties")
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {// NOSONAR
SpringApplication.run(Application.class, args);
}
}
@Configuration
public class ApplicationConfig {
@Configuration
@ImportResource("classpath*:applicationContext.xml")
public static class XmlImportingConfiguration {
}
}
app.properties
#Spring Boot
server.contextPath=/myapp
server.servlet.context-path=/myapp
spring.application.name=myapp
server.tomcat.max-threads=200
server.port=901
server.error.whitelabel.enabled=false
logging.level.org.springframework.web: INFO
logging.level.org.springframework: INFO
logging.level.com.wellsfargo: INFO
server.tomcat.accessLogEnabled=false
logging.config=config/log4j2.xml
spring.view.prefix: /WEB-INF/jsp/
spring.view.suffix: .jsp
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<util:map id="lookup">
<entry key="60" value="1 hour"></entry>
<entry key="480" value="8 hours"></entry>
<entry key="1440" value="24 hours"></entry>
<entry key="2880" value="2 days"></entry>
</util:map>
</beans>
@Controller
@RequestMapping("/")
public class MyController{
@Resource(name="lookup")
private Map<String,String> lookup;
}
我有解决这个问题的办法。基本上将映射从ApplicationContext.xml移动到应用程序属性,并使用@value检索,如下所示。
app.properties
lookup={'60':'Last 1 hour','480':'Last 8 hours','1440':'Last 24 hours','2880':'Last 2 days'}
ApplicationProperties.java
@Value("#{${lookup}}")
private Map<String,String> lookupTimeinterval;
问题内容: 我在使用表单时遇到一些基本麻烦。这就是我所做的。 我从这里获取了这个很酷的指令:https : //github.com/TheSharpieOne/angular-input- match 看起来像这样: 本质上,此指令监视其附加到模型值的元素,并将其与match属性中的模型值进行比较。 所以…例如,下面我们正在看两个密码是否匹配: 该指令似乎有效,因为它可以适当地设置ng-vali
我有一个表,它有一个主键,这个主键是用table Generator生成的: @tablegenerator(name=“resourceidgenerator”,table=“sequence”,pkColumnName=“name”,pkColumnValue=“resource_type_id”,valueColumnName=“nextid”,allocationSize=1),它工作得很
描述 我有一个小应用程序,它使用hook更新状态,但每次更新时,都会导致页面延迟。我指的是实际的延迟,而不仅仅是“等待异步”延迟。 我的理论是,更新状态会重新呈现太多的组件,因为如果我将状态减少到更少的值,滞后就会消失。 从本质上说,我担心我更新状态的方式没有隔离我想要的值。 密码 我将回购加载到CodeSandbox:https://codesandbox.io/s/long-forest-y9
更新Google Cloud SDK 189.0.0后,以前很好的命令现在错误如下:
问题内容: 问题 :定期更新GUI字段时,SWT冻结。 我想有一个带有文本字段的基于SWT的GUI,其值会定期增加。 最初,我从单独的线程访问textField导致抛出异常: 线程“ Thread-0”中的异常org.eclipse.swt.SWTException:在org.eclipse.swt.SWT.error(SWT.java)的org.eclipse.swt.SWT.error(SWT
我从画布生成图片(它在中),并从它制作一个MessageAtt法规: 然后,我创建一个嵌入对象,如下所示,其中包括作为文件附件的图像: 第一次将此对象发送到文本频道(