我的spring+jersey应用程序集成了togglz。我如下所示添加了下面的依赖项。
// togglz
compile('org.togglz:togglz-servlet:'+togglzVersion)
compile('org.togglz:togglz-cdi:'+togglzVersion)
compile('javax.enterprise:cdi-api:2.0-EDR1')
compile('org.togglz:togglz-spring-web:'+togglzVersion)
compile("org.togglz:togglz-spring-boot-starter:"+togglzVersion)
compile("org.togglz:togglz-console:"+togglzVersion)
compile("org.togglz:togglz-spring-security:"+togglzVersion)
compile("com.github.heneke.thymeleaf:thymeleaf-extras-togglz:1.0.1.RELEASE")在我的引导类中,我添加了以下代码:
@Bean
public FeatureProvider featureProvider() {
return new EnumBasedFeatureProvider(AppFeatures.class);
}启动应用程序后,我可以从以下链接看到json数据:http://localhost:8080/togglz。但我不能访问http://localhost:8080/togglz-console。我被“加载资源失败:服务器响应的状态为403 (禁止的”错误)。
我可以在日志文件中看到下面的日志,但我无法访问togglz-控制台/*。
o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'togglzConsoleServlet' to [/togglz-console/*]下面是我的togglz属性文件:
# togglz
togglz:
feature-enums: com.cooltoo.backend.features.AppFeatures # Comma-separated list of fully-qualified feature enum class names.
features:
SMS_CODE: false
console:
enabled: true # Enable admin console.
path: /togglz-console # The path of the admin console when enabled.我错过了什么?
发布于 2016-06-07 06:20:04
Step1添加以下依赖项:
<!-- Togglz Admin Console -->
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-console</artifactId>
<version>2.3.0.RC1</version>
</dependency>Step2在application.yml或application.properties中添加以下内容
togglz:
console:
enabled: true # Enable admin console.或
togglz.console.enabled: true # Enable admin console.Step3配置控制台路径
togglz:
console:
path: /togglz-console # The path of the admin console when enabled.对于身份验证:添加一个虚拟UserProvider,它将管理权限分配给每个用户:
public class MyTogglzConfiguration implements TogglzConfig {
@Override
public UserProvider getUserProvider() {
return new UserProvider() {
@Override
public FeatureUser getCurrentUser() {
return new SimpleFeatureUser("admin", true);
}
};
}
}如果您想对用户进行身份验证,而不是上面的虚拟用户,请按照下面的UserProvider来实现您自己的文档
发布于 2020-10-22 15:00:30
请在您的application.yml或application.properties中添加以下内容:
togglz:
console:
enabled: true
path: /togglz-console
use-management-port: false或
togglz.console.enabled: true
togglz.console.path: /togglz-console
togglz.console.use-management-port: false将togglz.控制台. the management- port设置为false将始终在应用程序端口上运行管理控制台。
https://stackoverflow.com/questions/36352832
复制相似问题