Java spring jdbcTemplate是否清除URL';s

Java spring jdbcTemplate是否清除URL';s,java,json,oracle,rest,spring-boot,Java,Json,Oracle,Rest,Spring Boot,我在构建SpringBootAPI的过程中遇到了一些小问题,我希望更熟悉SpringBoot幕后工作原理的人能够给我一些建议 我在控制器中有一个@ResponseBody标记的方法,该方法进行DB查询并将结果封送到JSON,如下所示: @RequestMapping(value = "/oneLibInfo",method = RequestMethod.GET) @ResponseBody List<LibInfo> getOneLibInfo(@Reque

我在构建SpringBootAPI的过程中遇到了一些小问题,我希望更熟悉SpringBoot幕后工作原理的人能够给我一些建议

我在控制器中有一个@ResponseBody标记的方法,该方法进行DB查询并将结果封送到JSON,如下所示:

    @RequestMapping(value = "/oneLibInfo",method = RequestMethod.GET)
    @ResponseBody
    List<LibInfo> getOneLibInfo(@RequestParam(required = true,value = "NUC")String NUC){

    List<LibInfo> libInfos = jdbcTemplate.query(
            "select o.organisation_id, o.name, a.alias, i.service_id, i.library_system_id, i.web_catalog_baseurl, ls.LIBRARY_SYSTEM_NAME,ls.LIBRARY_SYSTEM_VENDOR,ls.QUERY_PARAM_ISBN,ls.QUERY_PARAM_TITLE,ls.QUERY_PARAM_ISBN,ls.QUERY_PARAM_AUTHOR_TITLE\n" +
                    "from ALG1.LIBRARY_SYSTEM ls\n" +
                    "  INNER JOIN ALG1.ALG_INFORMATION i on i.LIBRARY_SYSTEM_ID = ls.LIBRARY_SYSTEM_ID\n" +
                    "  inner join dir.service s on s.service_id = i.service_id\n" +
                    "  inner join dir.organisation o on o.organisation_id = s.organisation_id\n" +
                    "  inner join dir.organisation_alias a on a.organisation_id = o.organisation_id\n" +
                    "where a.alias in (?)\n" +
                    "      and a.alias_type = 'Union catalogue symbol'",
            new Object[]{NUC}
            ,new BeanPropertyRowMapper<>(LibInfo.class,false)
    );
    return libInfos;
    }
公共类LibInfo{

public LibInfo() {
}


public LibInfo(String name, String alias, String serviceId, String librarySystemId, String webCatalogueBaseurl, String librarySystemName, String librarySystemVendor, String queryParamIsbn, String queryParamTitle, String queryParamIssn, String queryParamAuthorTitle) {
    this.name = name;
    this.alias = alias;
    this.serviceId = serviceId;
    this.librarySystemId = librarySystemId;
    this.webCatalogueBaseurl = webCatalogueBaseurl;
    this.librarySystemName = librarySystemName;
    this.librarySystemVendor = librarySystemVendor;
    this.queryParamIsbn = queryParamIsbn;
    this.queryParamTitle = queryParamTitle;
    this.queryParamIssn = queryParamIssn;
    this.queryParamAuthorTitle = queryParamAuthorTitle;
}

String name;
String alias;
String serviceId;
String librarySystemId;
String webCatalogueBaseurl;
String librarySystemName;
String librarySystemVendor;
String queryParamIsbn;
String queryParamTitle;
String queryParamIssn;
String queryParamAuthorTitle;

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getAlias() {
    return alias;
}

public void setAlias(String alias) {
    this.alias = alias;
}

public String getServiceId() {
    return serviceId;
}

public void setServiceId(String serviceId) {
    this.serviceId = serviceId;
}

public String getLibrarySystemId() {
    return librarySystemId;
}

public void setLibrarySystemId(String librarySystemId) {
    this.librarySystemId = librarySystemId;
}

public String getWebCatalogueBaseurl() {
    return webCatalogueBaseurl;
}

public void setWebCatalogueBaseurl(String webCatalogueBaseurl) {
    this.webCatalogueBaseurl = webCatalogueBaseurl;
}

public String getLibrarySystemName() {
    return librarySystemName;
}

public void setLibrarySystemName(String librarySystemName) {
    this.librarySystemName = librarySystemName;
}

public String getLibrarySystemVendor() {
    return librarySystemVendor;
}

public void setLibrarySystemVendor(String librarySystemVendor) {
    this.librarySystemVendor = librarySystemVendor;
}

public String getQueryParamIsbn() {
    return queryParamIsbn;
}

public void setQueryParamIsbn(String queryParamIsbn) {
    this.queryParamIsbn = queryParamIsbn;
}

public String getQueryParamTitle() {
    return queryParamTitle;
}

public void setQueryParamTitle(String queryParamTitle) {
    this.queryParamTitle = queryParamTitle;
}

public String getQueryParamIssn() {
    return queryParamIssn;
}

public void setQueryParamIssn(String queryParamIssn) {
    this.queryParamIssn = queryParamIssn;
}

public String getQueryParamAuthorTitle() {
    return queryParamAuthorTitle;
}

public void setQueryParamAuthorTitle(String queryParamAuthorTitle) {
    this.queryParamAuthorTitle = queryParamAuthorTitle;
}
}

这是从rest控制器返回的示例输出:

data
:
Array(1)
0
:
alias
:
"NSCU:L"
librarySystemId
:
"1194"
librarySystemName
:
"Alma-test3 NSCU"
librarySystemVendor
:
"Ex libris"
name
:
"University Library Lismore"
queryParamAuthorTitle
:
null
queryParamIsbn
:
"$$ISBN$$&tab=Everything&search_scope=MyInst_and_CI&vid=61SCU_INST:61SCU&offset=0"
queryParamIssn
:
null
queryParamTitle
:
"$$TITLE$$&tab=Everything&search_scope=MyInst_and_CI&vid=61SCU_INST:61SCU&offset=0"
serviceId
:
"4216"
webCatalogueBaseurl
:
null
最后一个条目就是问题所在

这是将SpringBoot 2.01与Oracle DB一起使用


似乎只有包含URL的列发出嘶嘶声

您的数据库列名为
web\u catalog\u baseurl
,但bean属性名为
webCatalogueBaseurl
<代码>目录vs
目录
,因此对于bean映射器来说,它是不同的

将bean属性重命名为
webCatalogBaseurl

private String webCatalogBaseurl;

public String getWebCatalogBaseurl() {
    return webCatalogBaseurl;
}

public void setWebCatalogBaseurl(String webCatalogBaseurl) {
    this.webCatalogBaseurl = webCatalogBaseurl;
}

这肯定是
JdbcTemplate
的一个意外的、未记录的特性。很好,我查过了名称,但没有查到。
private String webCatalogBaseurl;

public String getWebCatalogBaseurl() {
    return webCatalogBaseurl;
}

public void setWebCatalogBaseurl(String webCatalogBaseurl) {
    this.webCatalogBaseurl = webCatalogBaseurl;
}