小编ESD*_*sts的帖子

字段'SYSTEM_PROPERTIES_MODE_ENVIRONMENT'和PropertyPlaceHolderConfigurer之间有什么关系?

我使用spring 3.0.6-RELEASE用于基于Web应用程序的基本形式,并在使用PropertyPlaceHolderConfigurer启动时遇到以下错误.不知道是什么导致了这一点,因为注入属性pre-mvc3是通过bean完成的,现在使用注释,它看起来非常简单,至少来自docs /其他帖子.

但是,tomcat服务器启动期间的异常会引发org.springframework.core.ConstantException:在类[org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]中找不到字段'SYSTEM_PROPERTIES_MODE_ENVIRONMENT'

这是我在spring-servlet.xml中的内容

<context:property-placeholder location="/WEB-INF/classes/spring.properties"/>
Run Code Online (Sandbox Code Playgroud)

和我的控制器类

@Controller
@RequestMapping("/home")

public class HomeController {

    // @Resource(name="broomManager")
    @Autowired
    private broomManager broomManager;
    private @Value("${spring.broom.maxFileSize}") String inMemoryMaxFileSize;
    private @Value("${spring.broom.fileDestination}") String destFilePath;
Run Code Online (Sandbox Code Playgroud)

..

spring.properties

broom.maxFileSize=100000
broom.fileDestination=/Users/foobar/broom/files/
Run Code Online (Sandbox Code Playgroud)

启动时出现异常

2012-06-08 02:51:31,900 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'systemPropertiesModeName' threw exception; nested exception is org.springframework.core.ConstantException: Field 'SYSTEM_PROPERTIES_MODE_ENVIRONMENT' not found in class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]
    at …
Run Code Online (Sandbox Code Playgroud)

spring-mvc

12
推荐指数
1
解决办法
9071
查看次数

标签 统计

spring-mvc ×1