4
実行時にJersey ResourceConfigクラスのポートメンバーが0になっているのはなぜですか?SpringブートがJerseyのResourceConfigクラスの@Valueプロパティを設定していません
Application.propertyファイル:
#web server
server.port=9000
JerseyConfigファイル:
@Component
@ApplicationPath(Pathes.APPLICATION_PATH)
public class JerseyConfig extends ResourceConfig {
@Value("${server.port}")
private int port;
public JerseyConfig() {
final BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.0");
beanConfig.setHost("localhost:" + port);
beanConfig.setBasePath(Pathes.APPLICATION_PATH);
beanConfig.setResourcePackage(myPackages);
beanConfig.setScan(true);
register(ApiListingResource.class);
register(SwaggerSerializers.class);
}
}
感謝のあなたの助けのために!
https://github.com/dsyer/spring-boot-jersey –
あなたはあなたの特性をXMLに登録されている方法を共有することはできますか? –
スプリングブート時にXML設定ファイルはありません。私は起動時にスプリングブート自体によって読み込まれるapplication.propertiesファイルを使用しています。 – Chrisposure