小编Bri*_*zel的帖子

使用HTML5 + javascript进行演示的基本框架

您是否知道仅使用HTML5和JavaScript技术进行演示的框架?
我不是在谈论各种演示软件(powerpoint或OOo演示)的"导出"功能.

使用此"框架"进行演示的一些要求:

  • 利用最新的HTML5功能(音频,视频,画布?)
  • 与CSS3相同(字体支持,渐变,阴影,过渡和变换)

如果没有这样的事情,那么关于这个主题的好的演示或指针的例子将不胜感激.

编辑:找到一个很好的例子,HTML5 - Web开发到了一个新的水平.

javascript html5 presentation

100
推荐指数
2
解决办法
4万
查看次数

Spring Boot 3 springdoc-openapi-ui 不起作用

我正在尝试将 swagger-ui (OpenAPI 3.0) 添加到 Spring Boot v3 应用程序中。

我已经添加了 openapi-ui maven 依赖项,它应该按照文档工作。

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.6.11</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

但显然,它仍然不起作用,并且 localhost:8080/swagger-ui.html 返回 404 错误。

我缺少什么?

在此输入图像描述

java spring swagger-ui spring-boot

86
推荐指数
5
解决办法
9万
查看次数

更新到 Spring Security 6.0 - 替换已删除和已弃用的功能以保护请求

我正在尝试升级到 Spring Boot 3.0.0 和 Spring Security 6.0。

我发现保护请求的方法authorizeRequests()已被弃用。还有方法antMatchers()@EnableGlobalMethodSecurity注释也已删除。如何升级我的安全配置?

我的代码:

package org.sid.securityservice.config;

import com.nimbusds.jose.jwk.JWK;
import com.nimbusds.jose.jwk.JWKSet;
import com.nimbusds.jose.jwk.RSAKey;
import com.nimbusds.jose.jwk.source.ImmutableJWKSet;
import com.nimbusds.jose.jwk.source.JWKSource;
import com.nimbusds.jose.proc.SecurityContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.jwt.JwtEncoder;
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
import org.springframework.security.oauth2.jwt.NimbusJwtEncoder;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security spring-boot

68
推荐指数
1
解决办法
12万
查看次数

Spring Boot 2中缺少TomcatEmbeddedServletContainerFactory

我有Spring Boot应用程序版本1.5.x,它正在使用org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory,我正在尝试将其迁移到Spring Boot 2,但该应用程序无法编译,尽管它具有依赖性org.springframework.boot:spring-boot-starter-tomcat.编译器发出以下错误:

error: package org.springframework.boot.context.embedded.tomcat
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot

53
推荐指数
3
解决办法
3万
查看次数

如何在Spring Boot + Spring Security应用程序中配置CORS?

我使用Spring Boot和Spring Security以及Cors支持.

如果我执行以下代码

url = 'http://localhost:5000/api/token'
xmlhttp = new XMLHttpRequest
xmlhttp.onreadystatechange = ->
    if xmlhttp.readyState is 4
        console.log xmlhttp.status
xmlhttp.open "GET", url, true
# xmlhttp.setRequestHeader "X-Requested-With", "XMLHttpRequest"
xmlhttp.setRequestHeader 'Authorization', 'Basic ' + btoa 'a:a'
do xmlhttp.send
Run Code Online (Sandbox Code Playgroud)

我得到了结果

200
Run Code Online (Sandbox Code Playgroud)

如果我测试错误的凭据,如

url = 'http://localhost:5000/api/token'
xmlhttp = new XMLHttpRequest
xmlhttp.onreadystatechange = ->
    if xmlhttp.readyState is 4
        console.log xmlhttp.status
xmlhttp.open "GET", url, true
# xmlhttp.setRequestHeader "X-Requested-With", "XMLHttpRequest"
xmlhttp.setRequestHeader 'Authorization', 'Basic ' + btoa 'a:aa'
do xmlhttp.send
Run Code Online (Sandbox Code Playgroud)

而不是获得401(这是春季安全中错误身份验证的标准代码),我得到了

0
Run Code Online (Sandbox Code Playgroud)

以下浏览器通知:

获取http:// localhost:5000/api/token

XMLHttpRequest无法加载 …

javascript spring spring-security cors spring-boot

46
推荐指数
11
解决办法
12万
查看次数

@EnableGlobalMethodSecurity 在新的 Spring Boot 3.0 中已弃用

我使用 Spring Boot 3.0,当我进行安全配置时,我收到一条警告,指出它@EnableGlobalMethodSecurity已被弃用。

@Configuration
@EnableWebSecurity
@AllArgsConstructor
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig {
Run Code Online (Sandbox Code Playgroud)

@EnableGlobalMethodSecurity在 Spring boot 3.0 中我可以用什么来替代?

java spring-security spring-boot

36
推荐指数
1
解决办法
3万
查看次数

Spring Boot 3 中的 Spring 安全

我目前正在将 REST 应用程序从 Spring Boot 2.7.5 迁移到 3.0.0-RC2。我希望除了 Open API URL 之外的所有内容都是安全的。在 Spring Boot 2.7.5 中,我们曾经这样做:

@Named
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()
        .antMatchers("/openapi/openapi.yml").permitAll()
        .anyRequest().authenticated()
        .and()
        .httpBasic();
  }
}
Run Code Online (Sandbox Code Playgroud)

效果很好。在 Spring Boot 3 中,我不得不将其更改为

@Configuration
@EnableWebSecurity
public class WebSecurityConfig {

  @Bean
  public SecurityFilterChain configure(HttpSecurity http) throws Exception {
    http.authorizeHttpRequests((requests) -> requests
            .requestMatchers("/openapi/openapi.yml").permitAll()
            .anyRequest()
            .authenticated())
        .httpBasic();

    return http.build();
  }
}
Run Code Online (Sandbox Code Playgroud)

由于 WebSecurityConfigurerAdapter 已被删除。但它不起作用。Open API URL 也通过基本身份验证得到保护。我在升级代码时是否犯了错误,或者这可能是 Spring Boot 3 RC 2 …

spring-security spring-boot

33
推荐指数
2
解决办法
8万
查看次数

Spring boot 3 - Jakarta 和 Javax

在新的 Spring boot 3发行说明中,他们告诉我们该版本将使用 Jakarta EE 9(名为 的库jakarta)而不是 JEE(名为 的库javax)。

他们建议开发人员在本文中将importjavax替换为。jakarta

如果我有一个带有javaxjakartalib 的 Spring Boot 应用程序,该应用程序是否可以工作并能够部署在 Jakarta 兼容服务器(例如 Tomcat 10)中?

多谢。

spring tomcat spring-boot

32
推荐指数
1
解决办法
8万
查看次数

Spring Boot 3 微米追踪示例

如果我正确理解了这个问题的答案,Spring Cloud Sleuth 将被 Spring Boot 3 的 Micrometer Tracing 所取代。到目前为止,我使用 Spring Boot 3 里程碑 3 来实现跟踪的实验失败了。是否有一个示例项目可以用来指导我。

顺便说一句:这是我的实验https://github.com/stse/spring-boot-otel。我尝试使用测微计追踪和开放遥测技术通过 Otlp 和 Grpc 将追踪推送到新遗迹。

spring-boot micrometer

31
推荐指数
1
解决办法
2万
查看次数

使用已弃用的“-debug”后备进行参数名称解​​析。使用“-parameters”编译受影响的代码或避免其内省

我使用的是 Spring Boot 3.0.0、Eclipse IDE 2022-12、Java 语言级别/JDK 19。

文件pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0</version>
        <relativePath/>
    </parent>
    <groupId>com.example</groupId>
    <artifactId>spring_jwt</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <name>spring-boot-security-jwt</name>
    <description>spring_jwt</description>
    <properties>
        <java.version>19</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <version>0.11.5</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <version>0.11.5</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-jackson</artifactId>
            <version>0.11.5</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hibernate5-jakarta</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java eclipse spring spring-boot

21
推荐指数
2
解决办法
2万
查看次数