1. 程式人生 > >Configuration Annotation Proessor not found in classpath解決;

Configuration Annotation Proessor not found in classpath解決;

宣告,使用 springboot2.0、JDK8 、maven3.5.4

問題描述: 在springboot中自定義配置檔案 other.properties時候,報錯;

原因: *使用: @ConfigurationProperties(prefix = “other”) 這個註解,在springboot 2.0版本中,沒有 @location 註解,要手動新增@PropertySource(“classpath:other.properties”),並且新增依賴:
*

解決方案: 在pom.xml 中新增依賴;

		<dependency>
			<
groupId
>
org.springframework.boot </groupId> <artifactId> spring-boot-configuration-processor </artifactId> <optional> true </optional> </dependency>