基于模型 - 视图 - 控制器(MVC)模式构建Java Web应用程序的框架。它从底层视图技术中提升灵活和分离的代码。
从控制器调用 servlet,并将参数传递给 servlet
我正在编写一个jsp文件来使用一些参数调用控制器。我想从这个控制器通过传递来自控制器的值来调用 servlet。在 servlet 中我应该得到...
在 Spring Boot 应用程序中将 Problem-spring-web 依赖项从 v0.27.0 升级到 v0.29.1 时出现 NoClassDefFoundError
我正在开发一个 Spring Boot 项目,其中使用 Problem-spring-web 依赖项进行异常处理。 这是我的控制器建议: 包com.example.demo.error; //...其他进口.....
Spring addFormatters 未调用 WebMvcConfigurerAdapter
我正在尝试在 Spring Boot 应用程序中实现转换器,但由于某种原因,我对 addFormatters(FormatterRegistry formatterRegistry) 的重写从未被调用。令人困惑的是其他的overri...
如何使用ControllerAdvice中的ExceptionHandler处理控制器中的ExceptionHandler抛出的异常?
我有自定义异常扩展异常(MyException1,MyException2,MyException3) @控制器 公共类 MyController { /* 方法抛出 MyException1 方法抛出
我正在使用 thymeleaf 和 spring mvc。我想添加一个语言参数来更改区域设置。我是这样做的: Sp 我正在使用 thymeleaf 和 spring mvc。我想添加一个语言参数来更改区域设置。我是这样做的: <a th:href="@{${currentUrl}(lang='es_ES')}" th:if="__${#locale}__ != 'es_ES'" >Sp</a> <a th:href="@{${currentUrl}(lang='en_US')}" th:if="__${#locale}__ != 'en_US'" >Eng</a> 但在某些视图中,我的 URL 中有参数。我如何添加参数? 满足具体参数我就知道怎么添加了: <a th:href="@{${currentUrl}(fooParam = ${fooValue}, lang='es_ES')}" th:if="__${#locale}__ != 'es_ES'" >Sp</a> 但是我不知道所有视图中所有参数的数量和名称。如何获取当前url的所有参数? 如果您正在寻找 thymeleaf 仅模板版本,您可以将 ${#request.getRequestURI()} 与 ${#request.getQueryString()} 一起使用,并通过串联添加其他参数: <a th:href="@{${url}}" th:with="url=${#request.getRequestURI()+'?'+#request.getQueryString()+'&foo=bar'}">Link</a> 有关更多详细信息,请参阅https://stackoverflow.com/a/75103428/2590616 Thymeleaf >=3.1 更新: 由于安全原因,#request、#response、#session 和 #servletContext 不幸地不再可用于表达式:https://www.thymeleaf.org/doc/文章/thymeleaf31whatsnew.html#表达限制 您可以尝试创建一个实用服务来构建 URL 的参数部分。该实用程序方法将从列表中获取输入并通过 StringBuffer 构建字符串。结果将是一个字符串,就像您手动编写参数时一样。现在,您可以使用 thymeleaf 中内置的预解析器语法来调用该实用程序并构建最终的 url。 这里是例子: 公用事业服务 @Service("thymeleafUtilsService") public class ThymeleafUtilsService { public String buildMultiParamPartUrl(List<String> paramNames) { StringBuffer sb = new StringBuffer(0); for ( String paramName : paramNames ) { if ( sb.length() >= 0 ) { sb.append(","); } sb.append(paramName).append("=${").append(paramName).append("}"); } return sb.toString(); } } 用于测试的控制器 @Controller("multiParamLinkController") @RequestMapping(value = "/multiParamLink") public class MultiParamLinkController { @RequestMapping(value = { "/", "" }, method = RequestMethod.GET) public String testMultiParamsGenerator(Model model) { List<String> paramNames = new ArrayList<>(); paramNames.add("fooValue"); paramNames.add("barValue"); paramNames.add("lang"); model.addAttribute("fooValue", "foo"); model.addAttribute("barValue", "bar"); model.addAttribute("lang", "US_us"); model.addAttribute("paramNames", paramNames); return "multiParamLink/multiParamLink.html"; } } 测试用Html模板: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> <head> </head> <body> <a th:href="@{${currentUrl}(__${@thymeleafUtilsService.buildMultiParamPartUrl(paramNames)}__)}">myLink</a> <h1>Result</h1> <pre th:inline="text">[[@{${currentUrl}(__${@thymeleafUtilsService.buildMultiParamPartUrl(paramNames)}__)}]]</pre> </body> </html> 这就是您从示例中得到的结果: 您现在可以自定义此示例以适合您的代码,例如解析映射而不是列表或字符串...
Spring RestTemplate 处理状态为 NO_CONTENT 的响应时的行为
好吧,我有一个 NamedSystems 类,它的唯一字段是一组 NamedSystem。 我有一种方法可以根据某些条件查找 NamedSystems。这并不重要。当得到结果时,
我有以下界面: 公共接口MailSender { void sender(字符串到,字符串主题,字符串正文); } 它的2个实现: 公共类 SmtpkMailSender 实现 MailSender...
当我编译我的spring项目时,出现以下错误。 无法调用 org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(java.sql.SQLException, String) 因为 org.
我试图在我的项目中应用 Spring Rest 文档,所以我遵循官方参考网站的指南。但我无法制作任何片段。 这是我的 build.gradle。 插件{ 身份证号...
Spring 异常处理:@Exception 处理程序未被调用
我最近正在使用 hibernate、thymeleaf 和 spring security 开发 spring 应用程序。 我偶然发现了一种情况:我做了一个自定义异常: @ResponseStatus(HttpStatus.BAD_REQUEST) 公共...
所以我写了paypal结帐控制器方法,我将它设置为一个按钮,当你按下网站上的按钮时,它会加载到paypal结帐网站,你可以登录并付款,它可以工作。 .
根本找不到解决方案。所有凭据都是权利。仍然不起作用。我正在使用 spring 3,hibernate 3。这是我的 porm.xml。 根本找不到解决方案。所有凭证都是权利。仍然不起作用。我正在使用 spring 3,hibernate 3。这是我的 porm.xml。 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework.samples.service.service</groupId> <artifactId>LoginSpring2</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <properties> <!-- Generic properties --> <java.version>1.6</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- Web --> <jsp.version>2.2</jsp.version> <jstl.version>1.2</jstl.version> <servlet.version>2.5</servlet.version> <!-- Spring --> <!-- <spring-framework.version>3.2.3.RELEASE</spring-framework.version> --> <!-- Hibernate / JPA --> <!-- Logging --> <logback.version>1.0.13</logback.version> <!-- <slf4j.version>1.7.5</slf4j.version> --> <!-- Test --> <junit.version>4.11</junit.version> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.2.9.RELEASE</version> </dependency> <!-- Spring MVC --> <!-- hi <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring-framework.version}</version> </dependency> --> <!-- Other Web dependencies --> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>${jstl.version}</version> </dependency> <!-- hi<dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>${servlet.version}</version> <scope>provided</scope> </dependency> --> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>${jsp.version}</version> <scope>provided</scope> </dependency> <!-- Spring and Transactions --> <!-- hi<dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring-framework.version}</version> </dependency> --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>3.1.1.RELEASE</version> </dependency> <!-- Logging with SLF4J & LogBack --> <!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j.version}</version> <scope>compile</scope> </dependency> --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.5.6</version> <type>jar</type> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.5.6</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logback.version}</version> <scope>runtime</scope> </dependency> <!-- Hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.5.6-Final</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.5.5-Final</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>3.0-alpha-1</version> <scope>provided</scope> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.3</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> <!-- <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.36</version> </dependency> <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.1.2.RELEASE</version> </dependency>--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.1.0.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.2.0.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>3.2.4.RELEASE</version> </dependency> </dependencies> </project> /////////////////////////////////////Here is my error logs./////////// org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:114) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at com.nitin.MyController.registerUser(MyController.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1665) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1207) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2249) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2280) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2079) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:400) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294) at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221) ... 68 more 25214 [http-8080-1] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect 25214 [http-8080-1] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as connection was null 25214 [http-8080-1] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory 25214 [http-8080-1] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 25214 [http-8080-1] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {} 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled 25214 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled 25222 [http-8080-1] INFO org.hibernate.impl.SessionFactoryImpl - building session factory 25234 [http-8080-1] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured 25234 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update 25234 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata 25238 [http-8080-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null 25238 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) 25238 [http-8080-1] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - could not get database metadata org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:168) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:386) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at com.nitin.MyController.registerUser(MyController.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:745) org.apache.commons.dbcp.SQLNestedException:无法创建 PoolableConnectionFactory(用户“root”@“localhost”访问被拒绝(使用密码:YES)) 在我看来就像一个简单的访问被拒绝错误。检查您是否使用正确的用户名和密码从应用程序中连接 mysql 客户端。
我花了一整天的时间来解决这个问题,但我找不到。 错误 HTTP 状态 500 - 类型异常报告 信息 描述 服务器遇到一个 int...
在网关/代理后面配置 Spring Security OIDC/OAuth2
我在 Spring Boot 微服务上遇到了有关 Spring Security 中令牌解密部分的问题。基本上会出现以下问题: 当在 @AuthenticationPri 上调用 getSubject() 方法时...
我的 spring MVC Thymeleaf 应用程序中有两个实体(java 类),用户和地址。 User 类包含 Address 类的一个字段并引用它。 我有一个 Thymeleaf 表单,其中包含输入
我是 Springs 的新手,所以请不要介意我的问题是否愚蠢 我有一个实现两个接口的类 公共类 AAA 实现 BBB、CCC { } 公共接口 BBB { 无效方法 BBB_...
使用 this.tokenRepository.loadToken(request) 方法从请求中加载 csrfToken,并且也使用方法 StringactualToken = request.getHeader(csrfToken.
Spring MVC - 为什么我在 GET 请求中需要模型对象?
看一下 Spring 提供的用于处理表单提交的示例: https://github.com/spring-guides/gs-handling-form-submission/tree/main/complete 这是 Spring MVC 控件的基本示例...
如何将 jasper-reports 与 Spring MVC 一起使用?
我想使用 jasper-reports 生成报告,但我无法确定控制器应包含哪些信息,因为当我创建报告时,我正在使用...的结果集作为数据源。
Spring Boot 中的 GetMapping 方法不起作用
我正在使用maven跟随SpringBoot教程,当我尝试使用@GetMapping映射index()方法时,当程序运行时,我只能在本地主机上看到这个: 白标错误页...