我正面临问题,因为DEBUG [http-nio-8080-exec-11:org.springframework.jdbc.core.StatementCreatorUtils] - JDBC getParameterType call failed - using fallback method instead: java.sql.SQLException: Unsupported feature
正在被记录,然后挂断。
这是我的项目的详细信息:
我将oracle
数据库和spring-boot
应用程序与父级一起使用:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/>
</parent>
我的主应用程序文件:
@SpringBootApplication
public class ClientManagementApplication {
public static void main(String[] args) {
SpringApplication.run(ClientManagementApplication.class,args);
}
}
数据源配置:
@Configuration
@EnableTransactionmanagement
public class DataSourceConfig {
@Autowired
private DataSource dataSource;
@Bean
public JdbcClientDetailsService jdbcClientDetailsService() {
// clients.jdbc(dataSource);
JdbcClientDetailsService jdbcClientDetailsService =new JdbcClientDetailsService(dataSource);
jdbcClientDetailsService.setPasswordEncoder(new BCryptPasswordEncoder());
return jdbcClientDetailsService;
}
}
Web安全配置:
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
}
}
控制器类为:
@RestController
@RequestMapping("/migration")
public class MigrationController {
private static Logger logger = LoggerFactory.getLogger(MigrationController.class);
@Autowired
private MigrationService migrationService;
@Value("${error.successResponse}")
private String successResponse;
@Value("${error.noResultFound}")
private String noResultFoundError;
@GetMapping("/testKey")
public ResponseEntity<?> testKey() {
migrationService.testAddClient();
return new ResponseEntity<>(HttpStatus.OK);
}
}
上面的控制器调用MigrationService
如下:
@Component
@Transactional
public class MigrationService {
private static Logger logger = LoggerFactory.getLogger(MigrationService.class);
@Autowired
private Oauth2Service oauth2Service;
public void testAddClient(){
oauth2Service.addClient("BajwFFHejN0VF1ff4qBvkxufkx0a","0oBoruZJDDHs1psnp3eHDVHodGMa");
}
}
插入数据库中的最后一个Oauth2Service
类是:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.client.BaseclientDetails;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.stereotype.Service;
@Service
public class Oauth2Service {
@Autowired
private JdbcClientDetailsService jdbcClientDetailsService;
public void addClient(String clientId,String clientSecret ) {
BaseclientDetails clientDetails = new BaseclientDetails(clientId,null,Constants.SCOPE_READ_WRITE,Constants.GRANT_TYPE_ALL,Constants.AUTHORITIES_ROLE);
clientDetails.setClientSecret(clientSecret);
jdbcClientDetailsService.addClientDetails(clientDetails);
}
}
在调试的同时,当我从jdbcClientDetailsService.addClientDetails(clientDetails);
执行语句Oauth2Service
时也会挂断
的addClient
方法。 (当邮递员致电/testKey
时)
对于数据库连接,我使用的是context.xml
,它从server.xml
中定义的完整连接池中读取连接,当我检索数据或获取表详细信息或access-token
时,它可以正常工作。 (在其他类中定义)
但是这种特殊的流程无法正常工作,最终导致挂断了开始中定义的消息。请在这里建议我所缺少的。
让我知道是否需要我提供更多的信息。