运行代码报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'community.servlet.context-path' in value "${community.servlet.context-path}"
1.发现controll文件没加注解@Controller,添加后报错:html中bean依然爆红,运行代码后报错:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'homeController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'community.servlet.context-path' in value "${community.servlet.context-path}"
UserService中contextPath注入的值为变量server.sevlet.context-path,而不是ommunity.servlet.context-path