问题
报异常,由于读取不到某些配置的属性导致初始化bean
解决
在IDEA中使用jetty:run运行Maven Java Spring MVC应用时指定Spring环境变量。
<context:property-placeholder location="classpath*:config-${spring.profiles.active}.properties"/>
因为在读取配置文件的xml中使用了环境变量来读取不同的配置文件
jetty:run -Dspring.profiles.active=test -f pom.xml
启动jar的示例
$ java -jar -Dspring.profiles.active=production demo-0.0.1-SNAPSHOT.jar