Java 为什么我能';不使用@PathVariable?

Java 为什么我能';不使用@PathVariable?,java,spring,spring-mvc,jdbctemplate,Java,Spring,Spring Mvc,Jdbctemplate,我在代码中找不到问题所在,我想使用链接中的id和@PathVariable来检索数据 我的控制器: @RequestMapping( "/reklam" ) public class RklamController { @RequestMapping("/{advertise_id}") public String reklamPage(@PathVariable String advertise_id, ModelMap model) throws IOException { Da

我在代码中找不到问题所在,我想使用链接中的id和@PathVariable来检索数据

我的控制器:

@RequestMapping( "/reklam" )
public class RklamController {



@RequestMapping("/{advertise_id}")
  public String reklamPage(@PathVariable String advertise_id, ModelMap model) throws IOException {

DataSource dataSource = DataSourceGenerator.getDataSource();


AdvertiseDaoImpl adD = new AdvertiseDaoImpl(dataSource);
Advertise advertise = adD.getAd(advertise_id);

int count = advertise.getCounter();
if( count == 0 ){
  count = 1;
}else{
   count += 1;
}

advertise.setCounter(count);

model.addAttribute("advertise", advertise);

return "reklam"; } }
和道:

@Override
public Advertise getAd(String id) {

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);

    try{
        String sql = " select * from Advertise where advertise_id = ? ";

        Advertise advertise = (Advertise) jdbcTemplate.queryForObject(sql,new Object[]{id},
                new BeanPropertyRowMapper(Advertise.class));

        return advertise;
    }catch (DataAccessException e){

    }

    return null;
}
当我运行它时,它显示:

这行显示了5次:

Thu Mar 23 16:43:30 AST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

最后我发现了这个问题,因为我在数据库中留下了一些空字段,我使用了select*查询,可以通过更改查询或不留下空字段来修复,但我不明白为什么,有人能解释一下吗?

是否有打印出来的堆栈跟踪?您是否在控制器类中添加了
@Controller
注释?请在调试级别启用日志并共享jetty日志。可能存在重复的