Tôi có xml này cấu hìnhĐăng ký đậu groovy vào mùa xuân java cấu hình
<?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:lang="http://www.springframework.org/schema/lang"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd">
<lang:groovy id="foo" script-source="${groovyBeanLocation}"/>
</beans>
tôi nhập khẩu cấu hình này trong ApplicationConfig của tôi, nhưng không muốn kết hợp một số loại cấu hình (java và xml).
Tôi làm cách nào để tạo cấu hình cho trước bằng java?
Chưa có lựa chọn nào. Xem https://jira.spring.io/browse/SPR-12300 và câu hỏi SO liên kết của nó. –
@ArtemBilan Tôi đã tìm thấy [GroovyScriptFactory] (http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scripting/groovy/GroovyScriptFactory.html) và [ScriptFactoryPostProcessor] (http: // docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scripting/support/ScriptFactoryPostProcessor.html), nhưng chưa tìm ra. Giải pháp chính xác là. –
Vâng, đó là sự thật. Nhưng cách đó không đơn giản như vậy đối với ứng dụng cuối cùng. Có thể tốt hơn là chỉ sử dụng '@ImportResource (" classpath: scriptsContext.xml ")' ngay bây giờ. –