GVKun编程网logo

css – 浏览器不尊重a:visited {text-decoration:none; }

16

如果您对css–浏览器不尊重a:visited{text-decoration:none;}感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于css–浏览器不尊重a:visit

如果您对css – 浏览器不尊重a:visited {text-decoration:none; }感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于css – 浏览器不尊重a:visited {text-decoration:none; }的详细内容,并且为您提供关于.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.、AddDbContext was called with configuration, but the context type ''NewsContext'' only decla...、applicationContext-common.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/E...、Asp.Net Core报错System.Text.Json.JsonException: A possible object cycle was detected which is not supp的有价值信息。

本文目录一览:

css – 浏览器不尊重a:visited {text-decoration:none; }

css – 浏览器不尊重a:visited {text-decoration:none; }

我无法从访问过的链接中删除下划线.在我的计算机中,下面的小提琴在任何浏览器(当前版本的Chrome,Firefox和IE)中显示访问链接的黑色带下划线的文本.

a:link       { color: red;   text-decoration: underline; }
a:visited    { color: black; text-decoration: none;      }
<p><a href="http://www.nevervisited.com">This link is not visited.</a></p>
<p><a href="http://www.google.com">This is link is visited.</a></p>

这是Chrome访问链接的检查员.

我怀疑a:被访问的灰色与此有关,但this question关于灰色样式对我没有任何作用,尽管它帮助了许多其他人.

这些答案(this,this)表明规范并不关心子元素的文本装饰,当他们的祖先定义它时,但我不认为这是这种情况.我的< a> s没有下划线的父母,也没有使用伪元素,而是使用伪类.

此外,如果W3C说明,为什么Chrome会将访问链接应用于:链接

The two states [a:link and a:visited] are mutually exclusive.

也许这与隐藏网站私人信息的用户代理有关,比如W3C在之前的报价之后建议?这个:

Note. It is possible for style sheet authors to abuse the :link and :visited pseudo-classes to determine which sites a user has visited without the user’s consent.

UAs may therefore treat all links as unvisited links,or implement other measures to preserve the user’s privacy while rendering visited and unvisited links differently.

解决方法

您可以在大多数基于Webkit的浏览器(如Safari)或基于Blink(Chrome和Opera)的访问链接上应用的唯一CSS属性是彩色的.其他任何东西都行不通.它与浏览器历史窃取有关.您可以从这里阅读更多相关信息:

http://seclists.org/fulldisclosure/2013/May/13

但是,您可以使用{text-decoration:none;}更改所有链接的样式.

选择器本身并不危险,但是如果你将它与J​​avascript的功能结合起来就像getComputedStyle()一样,事情会变得非常丑陋而丑陋我的意思是其他用户可以查看和阅读你的个人浏览器历史记录.

Mozilla(壁虎引擎)limited the selector properties颜色,背景颜色,边框 – * – 颜色.

.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.

.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.
	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:408)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2385)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2306)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
	at sun.reflect.GeneratedConstructorAccessor4.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
	at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:443)
	at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:141)
	at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:111)
	at cn.qjj.mysql.MySQLPool.getNewConnection(MySQLPool.java:72)
	at cn.qjj.mysql.MySQLPool.init(MySQLPool.java:63)
	at cn.qjj.mysql.MySQLPool.<init>(MySQLPool.java:32)
	at cn.qjj.mysql.MySQLPool.getInstance(MySQLPool.java:39)
	at cn.qjj.mysql.SqlUtils.<clinit>(SqlUtils.java:33)
	at cn.qjj.solr.MsgUtil.main(MsgUtil.java:31)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
	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:408)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1112)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2483)
	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2324)
	... 18 more
java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
	at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
	at cn.qjj.mysql.MySQLPool.init(MySQLPool.java:63)
	at cn.qjj.mysql.MySQLPool.<init>(MySQLPool.java:32)
	at cn.qjj.mysql.MySQLPool.getInstance(MySQLPool.java:39)
	at cn.qjj.mysql.SqlUtils.<clinit>(SqlUtils.java:33)
	at cn.qjj.solr.MsgUtil.main(MsgUtil.java:31)



AddDbContext was called with configuration, but the context type ''NewsContext'' only decla...

AddDbContext was called with configuration, but the context type ''NewsContext'' only decla...

问题

An error occurred while starting the application.

ArgumentException: AddDbContext was called with configuration, but the context type ''NewsContext'' only declares a parameterless constructor. This means that the configuration passed to AddDbContext will never be used. If configuration is passed to AddDbContext, then ''NewsContext'' should declare a constructor that accepts a DbContextOptions<NewsContext> and must pass it to the base constructor for DbContext.
Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CheckContextConstructors<TContext>()

ArgumentException: AddDbContext was called with configuration, but the context type ''NewsContext'' only declares a parameterless constructor. This means that the configuration passed to AddDbContext will never be used. If configuration is passed to AddDbContext, then ''NewsContext'' should declare a constructor that accepts a DbContextOptions<NewsContext> and must pass it to the base constructor for DbContext.
Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CheckContextConstructors<TContext>()
Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.AddDbContext<TContextService, TContextImplementation>(IServiceCollection serviceCollection, Action<IServiceProvider, DbContextOptionsBuilder> optionsAction, ServiceLifetime contextLifetime, ServiceLifetime optionsLifetime)
Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.AddDbContext<TContextService, TContextImplementation>(IServiceCollection serviceCollection, Action<DbContextOptionsBuilder> optionsAction, ServiceLifetime contextLifetime, ServiceLifetime optionsLifetime)
Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.AddDbContext<TContext>(IServiceCollection serviceCollection, Action<DbContextOptionsBuilder> optionsAction, ServiceLifetime contextLifetime, ServiceLifetime optionsLifetime)
News.Startup.ConfigureServices(IServiceCollection services) in Startup.cs
+
            services.AddDbContext<NewsContext>(options =>
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

 

 

 

原因

NewsContext.cs

using Microsoft.EntityFrameworkCore;

namespace News.Service
{
    public class NewsContext : DbContext
    {
        public DbSet<News.Model.Entity.News> News { get; set; }
        public DbSet<News.Model.Entity.Banner> Banner { get; set; }
        public DbSet<News.Model.Entity.Comment> Comment { get; set; }
        public DbSet<News.Model.Entity.NewsClassify> NewsClassify { get; set; }
    }
}

 

Startup.cs

public void ConfigureServices(IServiceCollection services)
        {
            ......

            services.AddDbContext<NewsContext>(options =>
            {
              options.UseSqlServer(Configuration.GetConnectionString("MsSqlConnection"), db => db.UseRowNumberForPaging());
            });

            ......

        }

 

该错误表示,如果通过 AddDbContext 配置 NewsContext,那么需要添加一个 DbContextOptions<NewsContext> 类型参数的构造函数到 NewsContext 类。否则.net core 不能注入时带上 AddDbContext 添加的配置

 

解决方法

如上面所说,NewsContext 类添加一个 DbContextOptions<NewsContext> 类型参数的构造函数

using Microsoft.EntityFrameworkCore;

namespace News.Service
{
    public class NewsContext : DbContext
    {
        public NewsContext(DbContextOptions<NewsContext> options) : base(options)
        {
        }

        public DbSet<News.Model.Entity.News> News { get; set; }
        public DbSet<News.Model.Entity.Banner> Banner { get; set; }
        public DbSet<News.Model.Entity.Comment> Comment { get; set; }
        public DbSet<News.Model.Entity.NewsClassify> NewsClassify { get; set; }
    }
}

 

applicationContext-common.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/E...

applicationContext-common.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/E...

14:59:16,747 ERROR ContextLoader:350 - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [D:\eclipse\workspace_web\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\czyxyg_ws\WEB-INF\classes\applicationContext-common.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:614)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:515)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 42 more

 

 

pom文件引入:

  • <dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>1.4.01</version>
    </dependency>

Asp.Net Core报错System.Text.Json.JsonException: A possible object cycle was detected which is not supp

Asp.Net Core报错System.Text.Json.JsonException: A possible object cycle was detected which is not supp

Asp.Net Core报错:System.Text.Json.JsonException: A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32

检测到不支持的可能对象循环。这可能是由于周期或物体深度大于最大允许深度32。

这是由于进行了对象嵌套或ef 查询进行了预加载(关联加载)引起的,就像解释说的“对象循环”,层级太深解析不了。

解决方法:

添加 Microsoft.AspNetCore.Mvc.NewtonsoftJson 包
Startup中添加服务,忽略循环引用
services.AddControllers().AddNewtonsoftJson(option =>
//忽略循环引用
option.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore
);

services.AddControllers().AddNewtonsoftJson(option =>
                //忽略循环引用
                option.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            );

 


或者
通过另外创建一个类对查询到的数据进行封装后再返还。

关于css – 浏览器不尊重a:visited {text-decoration:none; }的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.、AddDbContext was called with configuration, but the context type ''NewsContext'' only decla...、applicationContext-common.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/E...、Asp.Net Core报错System.Text.Json.JsonException: A possible object cycle was detected which is not supp等相关知识的信息别忘了在本站进行查找喔。

本文标签: