-
1 votesanswersviews
如果静态内容部署为jar,则Spring引导404错误
我有spring boot应用程序和angular js项目作为两个不同的模块 . 角度js内容('dist'文件夹内的文件)被转换为jar文件,并作为Spring启动应用程序的一部分包含在内 . jar中的文件夹结构是/ static / ** . jar出现在spring boot应用程序的lib文件夹中 . 现在,当我尝试访问应用程序http://localhost:8080时,我收到40... -
22 votesanswersviews
运行jar时,带有静态内容的Spring Boot项目会生成404
Spring最近关于在Spring Boot项目中使用静态Web内容的博客文章(https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot)表明可以使用多个资源目录: / META-INF /资源/ / resources / / static / / public / 这要归功于W... -
122 votesanswersviews
Spring Boot不提供静态内容
我现在正撞在墙上几个小时 . 我的项目差不多完成了,但我无法让它服务于静态内容 . 我在 src/main/resources 下放置了一个名为 static 的文件夹 . 在里面我有一个名为 images 的文件夹 . 当我打包应用程序并运行它时,它找不到我放在该文件夹上的图像 . 我试图把静态文件放在 public , resources 和 META-INF/resources 但没有任何作... -
1 votesanswersviews
如何在tomcat服务器中集成angular6 spring boot
我想集成角度6和 spring 启动应用程序和最终输出制作可执行jar.I参考了一些教程,并按照以下步骤 . 1)使用ng build --prod我构建角度项目 . 2)在spring boot中的资源文件夹下创建静态文件夹,并将confied dist文件夹创建到静态文件夹 . 3)使用maven构建jar并在tomcat中部署 . 但是当我尝试访问index.html时,我总是得到404 我... -
0 votesanswersviews
角 spring 靴包装问题
我有 spring 靴角度项目的当前项目结构 +--app-ui |--+--src |--+--dist |--app-backend |--+--src |--+--+--main |--+--+--+--resources |--+--+--+--+--static |--+--+--+--java app-ui包含angular 6代码app后端包含spring引导代码 . 现在我每次构... -
2 votesanswersviews
Spring Boot提供的安全性阻止静态内容
我启动了Spring Boot Angular应用程序,现在我想将整个东西部署为jar . 所以我创建了maven配置,在其中构建了角度应用程序,然后将其复制到/ target / classes / resources 但是每个root用户请求(localhost:8080)都会被安全性阻止 . 当我禁用它时,我可以看到页面,这意味着整个事情已正确部署,但不知何故 Spring 天不允许我看到它... -
71 votesanswersviews
Spring @ResponseBody注释如何在这个RESTful应用程序示例中工作?
我有一个方法,通过以下方式注释: /** * Provide a list of all accounts. */ // TODO 02: Complete this method. Add annotations to respond // to GET /accounts and return a List<Account> to be converted. // Save... -
1 votesanswersviews
WebService - 无法初始化代理 - 无会话
我尝试通过WebService从我的数据库中获取数据列表 . 我使用Spring和Hibernate我已经阅读了一些话题,如This或This 所以我尝试将一些Transactionnal放在类的顶部,我的方法等等,但是没有工作,或者我没有用正确的参数将正确的东西放在正确的位置 . 谢谢,抱歉如果语法不好 EDIT :我认为这个问题来自我的 class Personne,它在懒惰模式下与很多其他实... -
7 votesanswersviews
跨应用程序的Spring Cloud Config Server共享属性
我目前有许多可部署的应用程序,它们以分布式方式工作以解决业务问题 . 我们目前正在使用许多属性配置文件来根据系统环境变量提供每个环境的更改配置 . 所有这些可部署应用程序共享数据库和消息传递的通用配置目前,这是通过从类路径中获取属性文件并使两个已部署的应用程序共享包含属性文件的每个连接(db,jms)的公共jar来实现的 . 我希望尽可能开始使用Spring Config Server外部化此配置... -
7 votesanswersviews
在Spring Cloud Config服务器中包含多个应用程序的通用配置
我正在尝试迁移稳定的应用服务器,以便从Spring Cloud Config服务器获取配置 . 每个应用程序在配置服务器上都有一个 {my-app}.yml 文件,我们可以使用配置文件(在名为 {my-app}-{profile}.yml 的文件中或使用多配置文件的YAML文档)为每个应用程序的每个环境配置不同的配置,我们甚至可以使用 spring.profiles.include 在另一个配置文... -
1 votesanswersviews
spring cloud配置版本
我在application.properties文件中有所有常用属性 . 特定于版本的属性位于github中的version1和version2文件夹中 . order-service(base folder) application.properties version1 app-dev.properties version2 app-de... -
1 votesanswersviews
Spring Cloud Config Server - 未返回属性
这个问题与post有关 . 这种方法似乎今天早些时候工作,但现在我看到下面的响应,而不是看到属性定义属性文件 - { "name": "order-service" "profiles": [1] 0: "dev-v1" - "label": null "version": &... -
0 votesanswersviews
spring-cloud-config:配置文件无法正常工作
我正在学习 spring-cloud-config 并且我想使用不同的配置文件,但我总是从 default 配置文件中获取值 . 我在git存储库中有两个属性文件,带有 prod 后缀的文件会覆盖 default profile中的一个键: image-service.properties image-service-prod.properties 看来我的配置服务器工作正常: GE... -
2 votesanswersviews
在同时使用@ResourceServer和@ EnableOauth2Sso的应用程序中为RestTemplate设置OAuth2标记
在我当前的项目中,我有一个应用程序,其中有一个小图形部分,用户使用SSO进行身份验证,以及一部分纯API,用户使用Authorization标头进行身份验证 . 例如: 使用SSO访问 /ping-other-service .使用承载令牌访问 /api/ping-other-service 作为所有 Cloud 原生,我们的应用程序与使用JWT令牌(UAA)使用相同SSO提供程序的其他服务... -
2 votesanswersviews
Spring安全客户端详细信息将作为DaoAuthenticationProvider中的用户详细信息
Spring Boot,安全OAuth2实现,默认令牌 endpoints (/ oauht / token)工作正常 . 但是,当我向/ oauth / http / token的新 endpoints 发送请求时,由于以下原因,它会抛出Bad Credentials: FilterChainProxy 触发大约12个过滤器,其中一个是 BasicAuthenticationFilter . ... -
4 votesanswersviews
具有OpenIDAuthenticationFilter问题的Spring Security
我有一些困难让OpenIDAuthenticationFilter工作,我希望有人可以帮助我 . 我的spring-security.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/bea... -
2 votesanswersviews
Java Spring:获取错误“Unknown property sub-element:<util:constant>”
我正在尝试为ioc使用util:constant标签,但是我收到以下错误消息: 线程“main”中的异常org.springframework.beans.factory.BeanDefinitionStoreException:在类路径资源[spring.xml]中定义名称为'threadPoolExecutor'的bean时出错:未知属性子元素:<util:constant> ... -
4 votesanswersviews
Spring MVC:Controller RequestMapping工作,但返回总是给出404
我的控制器方法中有几个SYSOUT,它们出现在控制台日志中......验证我所有的@RequestMapping都按预期运行 . 环境bean的@Autowiring也在工作(SYSOUT也正确显示) . 但是,方法的返回(我使用返回String类型的方法)仅导致404s . 找不到* .jsps . 项目正在使用Maven; IDE是eclipse kepler,FWIW . 我的ViewRes... -
2 votesanswersviews
spring . “schemaLocation ...必须有偶数个URI”
我的xml文件中的片段: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springfram... -
13 votesanswersviews
IntelliJ Spring Web MVC
我有IntelliJ 2016.1.3和Spring Web MVC集成的问题 . 我做的步骤: 文件 - >新建 - >项目... - > Maven(无原型) GroupId = test ArtifactId = app 项目名称=应用程序和完成 . 我添加到pom.xml <packaging> war </ packaging>... -
1 votesanswersviews
理解Spring MVC中的“globalValidator”
我有自定义验证器,我在我的控制器中注册它 @Controller public class MyController { @InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(new FooValidator()); } @Request... -
-1 votesanswersviews
Spring hibernate集成 - org.springframework.beans.factory.NoSuchBeanDefinitionException:没有定义名为'transactionManager'的bean
题 我尝试集成spring和hibernate,结果出现以下错误 . org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined at org.springframework.beans.factory.support.DefaultLi... -
0 votesanswersviews
cvc-complex-type.2.4.a:从元素'beans:bean'开始发现无效内容
其中一个'{“http://www.springframework.org/schema/beans":meta,ht tt://www.springframework.org/schema/beans”:constructor-arg,“http:// www .springframework.org / schema / beans“:property,”http://www.sp... -
-1 votesanswersviews
Spring:无法为XML模式命名空间找到Spring NamespaceHandler [http://www.springframework.org/schema/util]
我的代码适用于本地但不适用于我部署它 . 使用依赖项构建我的jar . My Exception: org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:无法找到XML架构命名空间的Spring NamespaceHandler [http://www.springframework.org/sc... -
0 votesanswersviews
在spring boot中使用MongoRepository开发自定义控制器时未使用的application.properties
我使用spring数据休息来进行经典的rest api调用,然后开发一些自定义控制器 . 我开始使用本地mongo db实例开发它,一切正常 . 现在我使用自定义控制器时遇到了一些问题 . 我在我的application.properties上设置 spring.data.mongodb.host 和 spring.data.mongodb.port ,并且spring数据提供的其余apis成功工... -
3 votesanswersviews
Mongo可审计的ZonedDateTime字段在Spring Boot 2中不起作用
在Spring Boot项目中,我使用@CreatedDate之类的注释来保存有关创建/更新相应文档的日期的信息 . ZonedDateTime在整个项目中使用,因此带注释的字段也是ZonedDateTime . 要启用Mongo的日期格式和ZonedDateTime之间的转换,请使用自定义转换器 . 现在,在使用Spring Boot 1.5.x时,自定义转换器可以完美地用于可审计字段 . 在... -
1 votesanswersviews
spring data mongodb LocalDateTime转换
我有一个简单的Model&Repository类,如下所示: StudentModel class: @Document(collection = "student") public final class StudentModel { @Id private final String name; private final LocalDateTim... -
3 votesanswersviews
Spring Framework安全漏洞CVE是否适用于Grails
适用于Spring Framework版本的一些漏洞包含在我的Grails部署中 . 这些也是Grails中的漏洞(包含Spring 3.1.4的v2.2.5)吗?此处列出的漏洞 http://www.cvedetails.com/vulnerability-list/vendor_id-9664/product_id-17274/Springsource-Spring-Framework.htm... -
1 votesanswersviews
使用java config将spring bean注册为apache camel route builder
apache camel documentation描述了如何使用@Component和SpringRouteBuilder注册路由构建器,然后跳转到xml代码来做 <camelContext xmlns="http://camel.apache.org/schema/spring"> <!-- and then let Camel use those @... -
0 votesanswersviews
绑定ConfigurationProperties(Spring Boot)时出现NullPointerException
我正在努力解决一些代码,我不知道为什么......这是我的代码: @SpringBootApplication @EnableConfigurationProperties(WorkflowRootProperties.class) @ComponentScan @ActiveProfiles("test") public class TestApplication { ...